Next: strings splitting, Previous: strings quote, Up: strings [Contents][Index]
Print an integer representing the length of string. The argument string can be an empty string.
Return successfully if string has length equal to length. The argument length must be a non-negative integer; the argument string can be an empty string.
Return successfully if string is empty.
Return successfully if string is not empty.
Select a character from a string. Echo to stdout the selected character. If the index is out of range: the empty string is echoed to stdout, that is: a newline is echoed to stdout.
The function variant _var
stores the result in the variable _RV, rather than print it;
Result variables.
mbfl_string_index abcdefghilm 0 -| a mbfl_string_index abcdefghilm 4 -| e mbfl_string_index abcdefghilm 10 -| m mbfl_string_index abcdefghilm 11 -| <empty string> local _RV mbfl_string_index_var _RV abcdefghilm 0 "$_RV" ⇒ a
Search characters in a string. Arguments: string, the target string; char, the character to look for; begin, optional, the index of the character in the target string from which the search begins (defaults to zero).
If the character is found: print an integer representing the index of the last occurrence of char in string, then return with status zero. If the character is not found: print nothing and return with status one.
The function variant _var
stores the result in the variable _RV, rather than print it;
Result variables.
mbfl_string_first abcdefghilm d -| 3 mbfl_string_first abcdefghilm a -| 0 mbfl_string_first abcdefghilm m -| 10 mbfl_string_first abcdefghilm X -| <empty string> mbfl_string_first abcdeabcde a 3 -| 5 mbfl_string_first abcdeabcde e 5 -| 9 mbfl_string_first abcdeabcde e 4 -| 4 local _RV mbfl_string_first_var _RV abcdefghilm d "$_RV" ⇒ 3
Search characters in a string starting from the end. Arguments: string, the target string; char, the character to look for; begin, optional, the index of the character in the target string from which the search begins (defaults to zero).
If the character is found: print an integer representing the index of the last occurrence of char in string, then return with status zero. If the character is not found: print nothing and return with status one.
The function variant _var
stores the result in the variable _RV, rather than print it;
Result variables.
mbfl_string_last abcdefghilm d -| 3 mbfl_string_last abcdefghilm a -| 0 mbfl_string_last abcdefghilm m -| 10 mbfl_string_last abcdefghilm X -| <empty string> mbfl_string_last abcdefghilm a 3 -| 0 mbfl_string_last abcdeabcde a 7 -| 5 mbfl_string_last abcdeabcde e 7 -| 4 mbfl_string_last abcdeabcde e 4 -| 4 local _RV mbfl_string_last_var _RV abcdefghilm d "$_RV" ⇒ 3
Extract a range of characters from a string. Arguments: string, the source string; begin, the index of the first character in the range; end, optional, the index of the character past the last in the range, this character is not extracted.
end defaults to the string length; if the parameter end is set to the lowercase string
end
or the uppercase string END
: the end index is set to the string length.
Echo to stdout the selected range of characters, which may be the empty string.
The function variant _var
stores the result in the variable _RV, rather than print it;
Result variables.
mbfl_string_range abcdefghilm 0 end -| abcdefghilm mbfl_string_range abcdefghilm 0 -| abcdefghilm mbfl_string_range abcdefghilm 0 4 -| abcd mbfl_string_range abcdefghilm 4 end -| efghilm local _RV mbfl_string_range_var _RV abcdefghilm 4 end "$_RV" ⇒ efghilm
Next: strings splitting, Previous: strings quote, Up: strings [Contents][Index]