Text.String the tag for the expression representing a string of text characters.
- 1 Definition
- 2 Known implementations
- 3 Programming
This expression must have no children.
This expression has internal state, which is an internal value of the string it contains.
There could be different visualizations, according with specific features, such like localization purposes.
Because strings can usually contains spaces, there should be visualizations that show strings indicating where they start and end. Possible methods are:
- Showing the string as it is
- Quoting the string
- Enclosing the string inside a visual artifact, like a rectangle.
Because this expression has internal state, edition may involve showing a dialog box in order to the user can introduce or edit the actual string.
Since this expression is not expected to be reduced to a different one, no reducers are currently known.
This package provides an implementation of the Text.String expression, which supports the following features:
- Unicode support. Strings can contain any character in the Unicode standard.
There are three visualizations on this package.
Both three visualizations show strings left to right, even in right-to-left written languages.
Simple string visualization
This visualization shows the string as it is, with no additional artifacts. it could be confusing, specially if the string contains spaces. The special case of an empty string, it is shown as the symbol "ε" (without quotes)
Boxed string visualization
This visualization shows strings inside a rectangle, to indicate where the string starts and ends. The following is an example:
Quoted string visualization
This visualization shows strings between quotation marks. The symbols of these quotation marks are locale dependent.
Notice that the quotes are visual artifacts added and they are not part of the actual string. If you want to actually add quotes to a given string, use the Localization.QuoteString expression.
The following shows examples of this visualization of an example string, in several locales. This example string is the 7-letter long string Fōrmulæ (æ is a single letter)
|Language||Example of visualization|
German (Austria, Germany, Greece & Luxembourg)
Chinese (Hong Kong & Taiwan)
|Rest of the world||“Fōrmulæ”|
When a string expression is created, it substitutes the previous selected expression. After the creation, the new string expression becomes the selected expression.
Edition "Creation of a string"
Since this expression has internal state, it opens a dialog box in order that the user can write the new string. The new Text.String expression substitutes the current selected expression and becomes the new selected expression.
Action "Edition of a string"
Since this expression has internal state, it opens a dialog box in order that the user can edit the string. The internal number of the Text.String currently selected is changed to the new value.
Being an expression with internal state, implementations of this expression must provide the necessary to access this state, and to provide a string representation of this state to be serialized.
|Programming language||Attribute name||Object retrieved|
|Java||"Value"||A String object reference containing the string.|
|C/C++||"Value"||A pointer where the string starts.|
The method of serialization must contain an attribute named "Value" containing the String contained in this Text.String expression.
There is no predefined format for expression serialization. The following are examples of Text.String expression in XML format:
|"Free expressions" (quotes included)|| |
- The list was generated by using the ICU Java library. The quotation definition were requested for all known locale definitions, and grouped. The most numerous group was selected as "The rest of the world".