String

Functions

Find a fragment anywhere in string of text (find)

Return the lowest index in s where the substring sub is found. Returns -1 if the fragment is not found.

 

{ }
[{"data":{"type":"library","step":"Find 'fox'","call":"string.find","args":{"word":"The quick brown fox jumps over the lazy dog","fragment":"fox","start":null,"end":null},"data_to_var":"result","maxpaths":1,"uuid":"fdca9b5c02f99534f1a128d64bec8871","x":531,"y":209,"width":120,"height":32,"string":"string","string.find":"find"},"paths":[]}]

Example Response

{"result":16}

Find a fragment in a portion of text (find)

Return the lowest index in s where the substring sub is found such that sub is wholly contained in between the 'start' and 'end' index. Returns -1 if the fragment is not found.

 

{ }
[{"data":{"type":"library","step":"Find 'fox' starting at 17","call":"string.find","args":{"word":"The quick brown fox jumps over the lazy dog","fragment":"fox","start":17,"end":null},"data_to_var":"result","maxpaths":1,"uuid":"fdca9b5c02f99534f1a128d64bec8871","x":531,"y":209,"width":120,"height":32,"string":"string","string.find":"find"},"paths":[]}]

Example Response

{"result":-1}

Count appearances of a fragment anywhere in string of text (count)

Return the number of (non-overlapping) occurrences of substring sub in string.

 

{ }
[{"data":{"type":"library","step":"Count 'o'","call":"string.count","args":{"word":"The quick brown fox jumps over the lazy dog","fragment":"o","start":null,"end":null},"data_to_var":"result","maxpaths":1,"uuid":"fdca9b5c02f99534f1a128d64bec8871","x":531,"y":209,"width":120,"height":32,"string":"string","string.find":"find"},"paths":[]}]

Example Response

{"result":4}

Count appearances of a fragment in a portion of text (count)

Return the number of (non-overlapping) occurrences of substring sub contained in between the 'start' and 'end' index. Defaults for start and end.

 

{ }
[{"data":{"type":"library","step":"Count 'o' starting at 17","call":"string.count","args":{"word":"The quick brown fox jumps over the lazy dog","fragment":"o","start":17,"end":null},"data_to_var":"result","maxpaths":1,"uuid":"fdca9b5c02f99534f1a128d64bec8871","x":531,"y":209,"width":120,"height":32,"string":"string","string.count":"count"},"paths":[]}]

Example Response

{"result":3}

Split string into a list/array (split)

Return a list of the words of the string s. If the optional second argument sep is absent or None, the words are separated by arbitrary strings of whitespace characters (space, tab, newline, return, formfeed). If the second argument sep is present and not None, it specifies a string to be used as the word separator. The returned list will then have one more item than the number of non-overlapping occurrences of the separator in the string. If maxsplit is given, at most maxsplit number of splits occur, and the remainder of the string is returned as the final element of the list (thus, the list will have at most maxsplit+1 elements). If maxsplit is not specified or -1, then there is no limit on the number of splits (all possible splits are made).

 

{ }
[{"data":{"type":"library","step":"split string on spaces","call":"string.split","args":{"word":"The quick brown fox jumps over the lazy dog","separator":" ","max":null},"data_to_var":"result","maxpaths":1,"uuid":"fdca9b5c02f99534f1a128d64bec8871","x":531,"y":209,"width":120,"height":32,"string":"string","string.split":"split"},"paths":[]}]

Example Response

{"result":["The","quick","brown","fox","jumps","over","the","lazy","dog"]}

Translate a string (translate)

Delete all characters from s that are in deletecharacters (if present), and then translate the characters using table, which must be a 256-character string giving the translation for each character value, indexed by its ordinal. If table is None, then only the character deletion step is performed.

 

{ }
[{"data":{"type":"library","step":"translate string","call":"string.translate","args":{"word":"The quick brown fox jumps over the lazy dog","input":"ou","output":"xy","deletecharacters":null},"data_to_var":"result","maxpaths":1,"uuid":"fdca9b5c02f99534f1a128d64bec8871","x":531,"y":209,"width":120,"height":32,"string":"string","string.translate":"translate"},"paths":[]}]

Example Response

{"result":"The qyick brxwn fxx jymps xver the lazy dxg"}

Replace words in a string (replace)

Return a copy of a string with all occurrences of substring old replaced by new. If the optional argument max is given, the first 'max' occurrences are replaced.

 

{ }
[{"data":{"type":"library","step":"replace 'the' with 'a' once","call":"string.replace","args":{"word":"The quick brown fox jumps over the lazy dog","old":"the","new":"a","max":1},"data_to_var":"result","maxpaths":1,"uuid":"fdca9b5c02f99534f1a128d64bec8871","x":531,"y":209,"width":120,"height":32,"string":"string","string.replace":"replace"},"paths":[]}]

Example Response

{"result":"a quick brown fox jumps over the lazy dog"}

Does a string start with a fragment (startswith)

Return true if string starts with the prefix, otherwise return false. prefix can also be a tuple of prefixes to look for. With optional start, test string beginning at that position. With optional end, stop comparing string at that position.

 

{ }
[{"data":{"type":"library","step":"does string start with 'fox'?","call":"string.startswith","args":{"word":"The quick brown fox jumps over the lazy dog","fragment":"fox","start":null,"end":null},"data_to_var":"result","maxpaths":1,"uuid":"fdca9b5c02f99534f1a128d64bec8871","x":531,"y":209,"width":120,"height":32,"string":"string","string.startswith":"startswith"},"paths":[]}]

Example Response

{"result":false}

Does a string start with a fragment (endswith)

Return true if the string ends with the specified suffix, otherwise return false. suffix can also be a tuple of suffixes to look for. With optional start, test beginning at that position. With optional end, stop comparing at that position.

 

{ }
[{"data":{"type":"library","step":"does string end with 'dog'?","call":"string.endswith","args":{"word":"The quick brown fox jumps over the lazy dog","fragment":"dog","start":null,"end":null},"data_to_var":"result","maxpaths":1,"uuid":"fdca9b5c02f99534f1a128d64bec8871","x":531,"y":209,"width":120,"height":32,"string":"string","string.endswith":"endswith"},"paths":[]}]

Example Response

{"result":true}