string-cmp and string-cmp-ic added

This commit is contained in:
vaclavt
2022-03-13 10:32:43 +01:00
parent 65abc2fd07
commit cd9822fcf2
7 changed files with 26 additions and 2 deletions

View File

@@ -134,6 +134,8 @@
|`(string-len str)`|Returns string length|`>>> (string-len "abcdef") => 6`|String manipulation|
|`(string-substr str pos len)`|Returns substring from str starting at pos with len. If pos is negative returns substring from the end of string. First character is on pos 0|`>>> (string-substr "ABCD" -2 2) => "CD"`|String manipulation|
|`(string-find str lookup pos)`|Returns position of lookup in str starting on position. First char index is 0. If not found returns nil|`>>> (string-find " long long int;" "long" 2) => 6`|String manipulation|
|`(string-cmp str1 str2)`|Compares two strings. Returns 0 where strangs are equal; < 0 when the value of the first character that does not match is lower in the compared string, or all compared characters match but the compared string is shorter.; >0 when the value of the first character that does not match is greater in the compared string, or all compared characters match but the compared string is longer.|`>>> (string-cmp "aaa" "xaa") => -23`|String manipulation|
|`(string-cmp-ic str1 str2)`|Compares two strings ignoring case. Returns 0, < 0, > 0.|`>>> (string-cmp-ic "aaa" "AaA") => 0`|String manipulation|
|`(int value)`|Cast an item to an int|`>>> (int 3.41) => 3`|Type casting|
|`(float value)`|Cast item to a float|`>>> (int 3.41) => 3.14`|Type casting|
|`(string value)`|Cast int or float item to a string|`>>> (string 3.14) => "3.14"`|Type casting|