[NAME] ALL.dao.type.string [TITLE] String Type [DESCRIPTION] string is a primitive data type that represents a sequence of bytes. Dao strings are not null-terminated, so they are effectively byte arrays that can be used to store any seque nces of bytes. But when processed as text, it is usually assumed to be encoded in UTF-8. 0.1 Basic Definition Strings can be expressed as string literals quoted with double or single quotation marks. 1 SingleQuoteString ::= ' ' ' ValidCharSequence ' ' ' 2 DoubleQuoteString ::= ' " ' ValidCharSequence ' " ' where ValidCharSequence can be anything but the quotation marks without backslash escapes . Any character in a string can be preceded with a escape backslash to specify a charater represented by: * Single decimal digit: \d; * Octal value with upto 3 digits: \ooo; * Hexidecial value with upto 2 digits prefixed by x: \xhh; * Hexidecial value with upto 4 digits prefixed by u: \uhhhh; * Hexidecial value with upto 8 digits prefixed by U: \Uhhhhhhhh; Here, these numbers will be interpreted as ASCII codes or UTF-8 codepoints. With backslas h escapes, a tab can also be represtend by \t, and a line break by \n and a carriage retu rn by \r. Any other character escaped by a backslash literally represents that character itself. 0.2 Verbatim String A verbatim string is a string that can contain anything without interpreting escape chara cters. 1 VerbatimString ::= '@[' [Delimiter] ']' Characters '@[' [Delimiter] ']' Where Delimiter can contain letters, digits, underscores, blank spaces, dots, colons, da shes and assignment marks. It must be unique such that '@[' [Delimiter] ']' does not appe ar in the string content. 0.3 Examples 1 var mbs = 'hello' 2 var wcs = "道语言" 3 var mbs2 = 'It\'s green' 4 var wcs2 = "\u9053\u8bed\u8a00" # the same as wcs; 5 6 # verbatim strings: 7 var mbs = @[] some text @[] 8 9 # C++ codes in verbatim string: 10 var cpp = 11 @[cpp x] 12 class AA 13 { 14 int index; 15 }; 16 struct BB{}; 17 @[cpp x] 18 19 20 # Lua codes in verbatim string: 21 var lua = 22 @[lua] 23 local a = 1; 24 function Test() 25 io.write( 'Hello' ) 26 end 27 @[lua] 28 29 # HTML codes in verbatim string: 30 var html = 31 @[html:123456] 32 <body> 33 <span name="test"></span> 34 </body> 35 @[html:123456] [STRUCTURE] dao.type.string--| dao.type.string: String Type (25.4 KB) |--pattern--| dao.type.string.pattern: String Pattern Matching (11.8 KB) |--method---| dao.type.string.method: Dao string methods (11.1 KB)