Wiki
Clone wikiDWScript / String
- summary String (base type)
String
Mutable, copy-on-write, 1-based, UTF-16 string type.
Description
Strings can be delimited by a single *'* or a double-quote *"*.
In a single-quoted string, a single quote can be expressed by doubling it.<br> In a double-quoted string, a double-quote can be expressed by doubling it. Double-quoted strings can span multiple lines.
Explicit Unicode characters can be specified by using # followed by an integer codepoint (decimal or hexadecimal). Characters specified this way are always understood as Unicode codepoint.
Print('Hello'#13#$0D'World');
Will print 'Hello' followed by CR+LF (ASCII code 13 and 10), followed by 'World', it can also be defined with
Print("Hello World");
Finally indented strings can also be defined with #" or #', the compiler will then ignore common indentation, and will additionally ignore an empty first line, so you can also write
Print(#" Hello World");
Methods
- Informations*
- High
- Low
- Length
- Testing*
- Contains
- StartsWith
- EndsWith
- Case conversions*
- LowerCase: ASCII lower case
- UpperCase: ASCII upper case
- ToLower: locale lower case
- ToUpper: locale upper case
- Conversions*
- ToBoolean
- ToInteger, ToIntegerDef
- ToFloat, ToFloatDef
- Manipulations*
- After: returns characters after a delimiter
- Before: returns characters before a delimiter
- DeleteLeft: delete N characters to the left
- DeleteRight: delete N characters to the right
- Dupe: duplicate the string N times
- Left: return N characters to the left
- Reverse: returns a version of the string with the character reversed
- Right: return N characters to the right
- Split: split a string on a separator and returns an array of strings
- Trim: trim control characters left & right
- TrimLeft: trim left control characters
- TrimRight: trim right control characters
Updated