Difference between revisions of "Escape Char"

From TaticView
Jump to: navigation, search
(Marked this version for translation)
 
Line 5: Line 5:
  
 
<!--T:2-->
 
<!--T:2-->
No TaticView o caractere ''barra'' '''\''' pode ser usado para indicar que o seu sucessor não tem significado especial, veja mais em [https://en.wikipedia.org/wiki/Escape_character Wikipedia 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 [https://en.wikipedia.org/wiki/Escape_character Wikipedia Escape Character]
  
 
<!--T:3-->
 
<!--T:3-->
Isso é útil principalmente nas [[Expressions|expressões]], que usam o caractere ''aspas duplas'' '''"''' para delimitar o nome de um campo, o problema ocorre quando o nome do campo tem esse caractere.
+
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.
Por exemplo, a [[Expressions|expressão]] envolvendo um campo chamado '''Parafuso 1"''', (perceba que o campo tem aspas duplas no nome, significando polegadas) sem o escape a [[Expressions|expressão]] seria escrita assim:
+
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:
  
===="Parafuso 1"" * "Preço Médio"==== <!--T:4-->
+
===="Screw 1 "" * "Average Price"==== <!--T:4-->
  
 
<!--T:5-->
 
<!--T:5-->
Essa [[Expressions|expressão]] gera um erro de sintaxe, já que a ''aspa dupla'' que delimita o nome também faz parte dele.
+
This [[Expressions|expression]] generates a syntax error, since the "double quotation mark" that delimits the name is also part of it.
A solução é usar o caractere de escape
+
The solution is to use the escape character
  
===="Parafuso 1\"" * "Preço Médio"==== <!--T:6-->
+
===="Screw 1 \"" * "Average Price"==== <!--T:6-->
  
 
<!--T:7-->
 
<!--T:7-->
O caractere ''barra'' indica ao TaticView que que o caractere que o sucede é um caractere normal, e não um delimitador de nome de campo.
+
The 'backslash' character tells TaticView that the character that succeeds it is a normal character, not a field name delimiter.
  
  
 
<!--T:8-->
 
<!--T:8-->
Com esse comportamento da barra, é necessário fazer o ''escape'' do próprio caractere barra, por exemplo, no caso de um identificador ter o caractere barra no seu nome, ele deve ser duplicado, indicando assim que o caractere faz parte do nome, e não um ''escape''.
+
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''.
Um exemplo, de um identificador que '''Preço\kg''', precisa ser escrito assim na [[Expressions|expressão]] '''Preço\\kg'''
+
An example, of an identifier that '''Price\kg''' needs to be written like this in [[Expressions|expression]] '''Price\\kg'''
  
  
 
<!--T:9-->
 
<!--T:9-->
O escape pode ser usado em outros casos, como no caso da ''aspa simples'' que também pode estar presente.
+
The escape can be used in other cases, as in the case of the "single quote" which may also be present.
  
 
<!--T:10-->
 
<!--T:10-->
Mais alguns exemplos:
+
Some more samples:
  
 
<!--T:11-->
 
<!--T:11-->
* "Produto" == 'D\'água'
+
* "Product" == 'D\'água'
  
 
<!--T:12-->
 
<!--T:12-->
* "Bairro" == 'Mont\'Serat'
+
* "District" == 'Mont\'Serat'
 +
 
 
</translate>
 
</translate>

Latest revision as of 12:36, 22 March 2021

Other languages:
English • ‎português do Brasil

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'