Skip to content

Commit

Permalink
Add text_position
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed May 17, 2024
1 parent 47b45d4 commit 78c4912
Showing 1 changed file with 92 additions and 0 deletions.
92 changes: 92 additions & 0 deletions proposals/text_position.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"id": "text_position",
"summary": "First position of a text in another text",
"description": "Checks where the text (also known as *string*) specified for `pattern` is positioned in the text specified for `data` for the first time. No-data values are passed through.",
"categories": [
"texts"
],
"parameters": [
{
"name": "data",
"description": "Text in which to find something in.",
"schema": {
"type": [
"string",
"null"
]
}
},
{
"name": "pattern",
"description": "Text to find in `data`. Regular expressions are not supported.",
"schema": {
"type": "string"
}
},
{
"name": "case_sensitive",
"description": "Case sensitive comparison can be disabled by setting this parameter to `false`.",
"schema": {
"type": "boolean"
},
"default": true,
"optional": true
}
],
"returns": {
"description": "A value >= 0 that indicates the position of the text, `-1` if the text was not found.",
"schema": {
"type": [
"integer",
"null"
],
"minimum": -1
}
},
"examples": [
{
"arguments": {
"data": "Lorem ipsum dolor sit amet",
"pattern": "openEO"
},
"returns": -1
},
{
"arguments": {
"data": "Lorem ipsum dolor sit amet",
"pattern": "ipsum dolor"
},
"returns": 6
},
{
"arguments": {
"data": "Lorem ipsum dolor sit amet",
"pattern": "Ipsum Dolor"
},
"returns": -1
},
{
"arguments": {
"data": "Lorem ipsum dolor sit amet",
"pattern": "SIT",
"case_sensitive": false
},
"returns": 18
},
{
"arguments": {
"data": "ÄÖÜ",
"pattern": "ö",
"case_sensitive": false
},
"returns": 1
},
{
"arguments": {
"data": null,
"pattern": "null"
},
"returns": null
}
]
}

0 comments on commit 78c4912

Please sign in to comment.