In addition to the ordinary characters that appear on a standard keyboard, you can include in Mathematica
strings any of the special characters that are supported by Mathematica
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 Mathematica
notebook, a special character such as
can always be displayed directly. But if you use a text-based interface, then typically the only characters that can readily be displayed are the ones that appear on your keyboard.
As a result, what Mathematica
does in such situations is to try to approximate special characters by similar-looking sequences of ordinary characters. And when this is not practical, Mathematica
just gives the full name of the special character.
In a Mathematica
notebook using StandardForm
, special characters can be displayed directly.
, however, the special characters are approximated when possible by sequences of ordinary ones.
always uses full names for special characters in InputForm
. This means that when special characters are written out to files or external programs, they are by default represented purely as sequences of ordinary characters.
This uniform representation is crucial in allowing special characters in Mathematica
to be used in a way that does not depend on the details of particular computer systems.
the full names of all special characters are always written out explicitly.
|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 "
or \ 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.