WOLFRAM LANGUAGE TUTORIAL
Special Characters in Strings
In addition to the ordinary characters that appear on a standard keyboard, you can include in Wolfram Language strings any of the special characters that are supported by the Wolfram Language.
Here is a string containing special characters.
You can manipulate this string just as you would any other.
Here is the list of the characters in the string.
In a Wolfram System notebook, a special character such as can always be displayed directly. But if you use a text‐based interface, then often the only characters that can readily be displayed are the ones that appear on your keyboard. Exactly which special characters can be displayed is inferred from the value of $CharacterEncoding.
As a result, what the Wolfram System does in such situations is to try to approximate special characters by similar‐looking sequences of ordinary characters. And when this is not practical, the Wolfram System just gives the full name of the special character.
In a Wolfram System notebook using StandardForm
, special characters can be displayed directly.
, however, special characters that cannot be displayed exactly are approximated when possible by sequences of ordinary ones.
When using InputForm or FullForm, special characters are not approximated. The Wolfram Language uses full names for non-representable special characters in InputForm, while FullForm always uses long names, even in the notebook interface.
, all characters not part of the encoding—
in this case the special characters other than é—
are written using long names.
, all special characters are written using long names.
By default, the Wolfram System uses the character encoding "PrintableASCII" when saving notebooks and packages. This means that when special characters are written out to files or external programs, they are represented purely as sequences of ordinary characters. This uniform representation is crucial in allowing special characters in the Wolfram Language to be used in a way that does not depend on the details of particular computer systems.
When creating packages and notebooks, special characters are always written out using full names.
Use the "PrintableASCII"
to create strings with no special characters.
, all special characters are written out fully when using "PrintableASCII"
|a||a literal character|
|\[Name]||a character specified using its full name|
|\" ||a " to be included in a string|
|\\||a \ to be included in a string|
Ways to enter characters in a string.
You have to use \
to "escape" any "
characters in strings that you enter.
produces a literal \
rather than forming part of the specification of
This breaks the string into a list of individual characters.
This creates a list of the characters in the full name of
And this produces a string consisting of an actual
from its full name.