Gentee Programming Language > Documentation > Syntax | Download documentation |
Strings are sequences of characters enclosed in double " quotation marks. All characters including line feeds and ignoring command characters are considered to be significant.
"This is string with a new line break. There is the next line."
Note, there is also a macro string. Like the string, a macro string is enclosed in quotation marks; moreover, they are preceded by a dollar sign '$'. Unlike the string, the macro string does not use a command character, but it replaces macros which appear in a string. This type of a string is very appropriate for pointing file paths.
define { mypath = $"c:\myfolder\subfolder" myname = "application" } ... s = $"$mypath\$myname$123.exe" // s = c:\myfolder\subfolder\application123.exe
The operator '\' is a command character, and actions performed by it are subject to characters followed this operator. Take into account that the command character can be redefined, thus considering the operator '\' the current command character.
\\ The command character output. \" A single character ". \a A bell character, code 0x07. \b Backspace, cancel character, code 0x08. \f Form feed, code 0x0c. \n Line feed, code 0x0A. \r Carriage return, code 0x0D. \t Horizontal tabulation, code 0x09. \l End-Of-Line - combination \r\n. It might be useful for output to a text file. \0XX Combination of command character and zero followed by a number of character in hexadecimal notation makes any character with code from 0 to 255 put in a string. \$macro$ In-line insertion of preprocessor macro. The last dollar sign '$' is optional if this sign is followed neither by letter nor by digit. \$"string" Insertion of a macro string. \% Disable command character processing to the end of string. \%[name] Disable command character processing to the end of string or to the occurrence of \name, furthermore name - combination of any characters. \# Deleting of the preceding line feed. \=n Redefining of a command character for the current string. n can be one of the following characters: \ / ~ ^ & :. \[comments] In-line insertion of remarks. \(...) Outputting a result of the expression. In parentheses there might be an expression of any type, where string conversion occurs. \<file> Content of the specified file is inserted. File name in the angle brackets must be specified as a macro string, i.e. ignoring the command character. \! On/off ignore instruction of double quote marks. After this instruction double quote marks are used without the command character. If you use this instruction for the next time, the double quote marks will denote the end of line character again. In the text function this instruction is denoted as the end of it.
"\=^This is string without a new line break. ^# There is no new line." //after compiling the string looks as follows: //"This is string without a new line break. There is no new line." ... a=1 b=2333 string="This is a string with the expression a + b = \( a + b )"
You can use str type for describing the string variable. You can find string methods and operations in Standard Library-Strings.
<str character> ::= <tabulation> | <space> | '!' | '#' | ... | '[' | ']' | ... | 0xFF
<ext str character> ::= <str character> | '\'
<any character> ::= <ext str character> | '"'
<macrostring element> ::= {<str character>|<end-of-line>| '$'<macro name>}
<const string element> ::= <str character> | <end-of-line> | '\\' | '\"' | '\a' | '\b' | '\f' | '\n' | '\r' | '\t' | '\l' | '\0'<byte> | '\$'<macro name>'$' | '\$"' {<macrostring element>} '"' | '\#' | '\=' ( '\' | '/' | '~' | '^' | '&' | ':') | '\%['[ {<ext str character>} ]']'{<ext str character>}[{<ext str character>}] | '\[' {<any character>}']' | '\<'{<macrostring element>}'>'
<string element> ::= {<ext str character>} | '\('<expression>')'
<const string> ::= '"' { <const string element> | '\!'{<const string element>| '"'}'\!' }'"'
<string> ::= '"' { <string element>| '\!'{<string element>| '"'}'\!' }'"'
![]() |
![]() Copyright © 2004-2006 Gentee Inc. All rights reserved. ![]() |