Characters in Strings
| Characters["string"] | convert a string to a list of characters |
| StringJoin[{"c1","c2",...}] | convert a list of characters to a string |
Converting between strings and lists of characters.
This gives a list of the characters in the string.
| Out[1]= |  |
You can apply standard list manipulation operations to this list.
| Out[2]= |  |
StringJoin converts the list of characters back to a single string.
| Out[3]= |  |
| DigitQ[string] | test whether all characters in a string are digits |
| LetterQ[string] | test whether all characters in a string are letters |
| UpperCaseQ[string] | test whether all characters in a string are uppercase letters |
| LowerCaseQ[string] | test whether all characters in a string are lowercase letters |
Testing characters in a string.
All characters in the string given are letters.
| Out[4]= |  |
Not all the letters are uppercase, so the result is
False.
| Out[5]= |  |
| ToUpperCase[string] | generate a string in which all letters are uppercase |
| ToLowerCase[string] | generate a string in which all letters are lowercase |
Converting between upper case and lower case.
This converts all letters to upper case.
| Out[6]= |  |
Generating ranges of characters.
This generates a list of lowercase letters in alphabetical order.
| Out[7]= |  |
Here is a list of uppercase letters.
| Out[8]= |  |
| Out[9]= |  |
CharacterRange will usually give meaningful results for any range of characters that have a natural ordering. The way CharacterRange works is by using the character codes that Mathematica internally assigns to every character.
This shows the ordering defined by the internal character codes used by
Mathematica.
| Out[10]= |  |