manual:chapter3:strings

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
manual:chapter3:strings [2017/09/02 13:54]
smartin [Commands for strings]
manual:chapter3:strings [2017/09/09 20:01]
claudio [Commands for strings]
Line 6: Line 6:
  
 ---- ----
 +==== Length of strings ====
 +
 +A Unicode Code Point is an indivisible unit of text. A character is usually a single Code Point, but not necessarily. A character may be formed by a group of Unicode Code Points that includes a starter character and optionally a series of overlapping characters or modifiers.
 +
 +There are separate commands to measure the length of a string. The most useful is ''STRLEN'', which returns the number of characters in a string. The command ''STRLENCP'' returns the number of Code Points in the string.
 +
 +Finally, the command ''SIZE'' returns the size in bytes of the string.
 +
 +
 +
 +
 ==== Commands for strings ==== ==== Commands for strings ====
 The following table summarizes commands which can be applied to strings. The following table summarizes commands which can be applied to strings.
  
 | Command | Purpose | Example | | Command | Purpose | Example |
-| ''→STR'' | Convert to string | ''45,569 →STR'' yields ''"45,569"''+| ''→STR'' | Convert object to string | ''45,569 →STR'' yields ''"45,569"''
-| ''STR→''Convert from string to implied object((In this case, ''OBJ→'' can also be used.))| ''"45,569." STR→'' yields ''45.569.''+| ''STR→''Compile a string to RPL objects((In this case, ''OBJ→'' can also be used.))| ''"45,569." STR→'' yields ''45.569.''
-| ''→NFC''Convert to NFC | ''"Hello World" →NFC'' yields ''"Hello World"''+| ''→NFC''Normalize a string to Unicode NFC | ''"Hello World" →NFC'' yields ''"Hello World"''
-| ''UTF8→'' | Convert each character in string to Unicode UTF8 object | ''"abcd" UTF8→'' yields ''{ #61h #62h #63h #64h }''+| ''UTF8→'' | Convert string to list of Unicode Code Points | ''"abcd" UTF8→'' yields ''{ #61h #62h #63h #64h }''
-| ''→UTF8'' | Convert list of Unicode UTF8 objects to a string | ''{ #61h #62h #63h #64h } →UTF8'' yields ''"abcd"''+| ''→UTF8'' | Convert list of Unicode Code Points to a string | ''{ #61h #62h #63h #64h } →UTF8'' yields ''"abcd"''
-| ''SIZE'' | Return the number of characters in a string | ''"Hello World" SIZE'' yields ''11''|+| ''SIZE'' | Return the number of bytes in a string | ''"Hello World" SIZE'' yields ''11''|
 | ''STRLEN'' | Returns the length of the string, in characters | ''"Hello World" STRLEN'' yields ''11'' | | ''STRLEN'' | Returns the length of the string, in characters | ''"Hello World" STRLEN'' yields ''11'' |
-| ''STRLENCP'' | Returns the length of the string, in characters | ''"Hello World" STRLEN'' yields ''11'' |+| ''STRLENCP'' | Returns the mumber of Unicode Code Points in a string | ''"Hello World" STRLEN'' yields ''11'' |
 | ''POS'' | Returns the position of a substring within a string (0 if not found) | ''"Hello World" "Wor" POS'' yields ''7''| | ''POS'' | Returns the position of a substring within a string (0 if not found) | ''"Hello World" "Wor" POS'' yields ''7''|
 | ''POSREV'' | Returns the position of the substring counting from end of sting (0 if not found) | ''"Hello World" "Wor" POSREV'' yields ''3'' | | ''POSREV'' | Returns the position of the substring counting from end of sting (0 if not found) | ''"Hello World" "Wor" POSREV'' yields ''3'' |
Line 24: Line 35:
 | ''SREV'' | Reverse the string | ''"Hello World" SREV'' yields ''"dlroW olleH"'' | | ''SREV'' | Reverse the string | ''"Hello World" SREV'' yields ''"dlroW olleH"'' |
 | ''REPL'' | Replace part of a string with another at the specified position | ''"Hello World" 7 "Universe" REPL'' yields ''"Hello Universe"''| | ''REPL'' | Replace part of a string with another at the specified position | ''"Hello World" 7 "Universe" REPL'' yields ''"Hello Universe"''|
-| ''SREPL'' | Search and replace a string (return 1 if successful, 0 if not) | ''"Hello World" "World" "Universe" SREPL'' yields ''"Hello Universe"'' |+| ''SREPL'' | Search and replace a string (return 1 if successful, 0 if not) | ''"Hello World" "World" "Universe" SREPL'' yields ''"Hello Universe" 1'' |
 | ''SUB'' | | | | ''SUB'' | | |
 | ''HEAD'' | | | | ''HEAD'' | | |
  • manual/chapter3/strings.txt
  • Last modified: 2017/09/09 20:07
  • by claudio