The following keywords are defined for string processing in LabTalk:
LabTalk Keyword | C Token | ASCII Code | Description |
---|---|---|---|
TAB | \t | 9 | The tab character |
CR | \r | 13 | Carriage Return |
LF | \n | 10 | Line feed (also, new line) |
CRLF | \r \n | 9, 13 | CR followed by LF, typically used as line separator in DOS/Windows |
QUOTE | \" | 34 | Double-quote |
This example shows how to use quotes inside a string in LabTalk
str$="expression=%(quote)col(1)=col(2)+1%(quote)"; str$=;// should print "expression="col(1)=col(2)+1"" int i = str.Find('"'); i=;//-->12 // same as '"' when used as a string function argument: i=str.Find(quote, i+1); i=;//-->28 i=str.Count('"'); i=;//-->2 i=str.Count(quote); i=;//--> also 2
Similar issues exist for new lines,
str$="line1%(CRLF)line2%(CRLF)line3"; type str$; type "str has $(str.GetNumTokens(CRLF)) lines"; //should print: //line1 //line2 //line3 //str has 3 lines