$str.lefttolast Returns the left part of a string until the last occurrence of a given substring |
Usage |
<string> $str.lefttolast(<string:string>,<substring:string>[,<case:bool>]) |
Description |
This function returns the left part of the string given as the first parameter from the first character until the last occurrence of the string given as the second parameter. The returned string doesn't include the substring of the second parameter in the returned value. If the substring is not found, the original string is returned. If the third parameter is set to true, then the search is case sensitive; it defaults to false. |
Examples |
%test = "Hello! My nickname is Pragma, my name is Szymon" echo $str.lefttolast(%test, My); // "Hello! My nickname is Pragma, " echo $str.lefttolast(%test, My, true); // "Hello! " echo $str.lefttolast(%test, invalid); // "Hello! My nickname is Pragma, my name is Szymon" |