Difference between revisions of "Escape Char"
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | <languages/> | ||
+ | <translate> | ||
+ | = Escape Character = <!--T:1--> | ||
− | |||
− | + | <!--T:2--> | |
+ | In TaticView the character ''backslash'' '' '\' '' can be used to indicate that its successor is a common character, has no special meaning, see more in [https://en.wikipedia.org/wiki/Escape_character Wikipedia Escape Character] | ||
− | + | <!--T:3--> | |
− | + | This is especially useful in [[Expressions|expressions]], which use the character '' double quotes '' '' '"' '' to delimit the name of a field, the problem occurs when the name of the field has that character. | |
+ | For example, the [[Expressions|expression]] involving a field called '''Screw 1 "''', (note that the field has double quotes in the name, meaning inches) without escaping [[Expressions|expression]] would be written like this: | ||
− | ===" | + | ===="Screw 1 "" * "Average Price"==== <!--T:4--> |
− | + | <!--T:5--> | |
− | + | This [[Expressions|expression]] generates a syntax error, since the "double quotation mark" that delimits the name is also part of it. | |
+ | The solution is to use the escape character | ||
− | ===" | + | ===="Screw 1 \"" * "Average Price"==== <!--T:6--> |
− | + | <!--T:7--> | |
+ | The 'backslash' character tells TaticView that the character that succeeds it is a normal character, not a field name delimiter. | ||
− | |||
− | + | <!--T:8--> | |
+ | With this slash behavior, it is necessary to "escape" the backslash character itself, for example, if an identifier has the backslash character in its name, it must be duplicated, thus indicating that the character is part of the name , not an ''escape''. | ||
+ | An example, of an identifier that '''Price\kg''' needs to be written like this in [[Expressions|expression]] '''Price\\kg''' | ||
− | |||
− | * " | + | <!--T:9--> |
+ | The escape can be used in other cases, as in the case of the "single quote" which may also be present. | ||
+ | |||
+ | <!--T:10--> | ||
+ | Some more samples: | ||
+ | |||
+ | <!--T:11--> | ||
+ | * "Product" == 'D\'água' | ||
+ | |||
+ | <!--T:12--> | ||
+ | * "District" == 'Mont\'Serat' | ||
+ | |||
+ | </translate> |
Latest revision as of 12:36, 22 March 2021
Escape Character
In TaticView the character backslash '\' can be used to indicate that its successor is a common character, has no special meaning, see more in Wikipedia Escape Character
This is especially useful in expressions, which use the character double quotes '"' to delimit the name of a field, the problem occurs when the name of the field has that character. For example, the expression involving a field called Screw 1 ", (note that the field has double quotes in the name, meaning inches) without escaping expression would be written like this:
"Screw 1 "" * "Average Price"
This expression generates a syntax error, since the "double quotation mark" that delimits the name is also part of it. The solution is to use the escape character
"Screw 1 \"" * "Average Price"
The 'backslash' character tells TaticView that the character that succeeds it is a normal character, not a field name delimiter.
With this slash behavior, it is necessary to "escape" the backslash character itself, for example, if an identifier has the backslash character in its name, it must be duplicated, thus indicating that the character is part of the name , not an escape.
An example, of an identifier that Price\kg needs to be written like this in expression Price\\kg
The escape can be used in other cases, as in the case of the "single quote" which may also be present.
Some more samples:
- "Product" == 'D\'água'
- "District" == 'Mont\'Serat'