Characters

Characters["string"]

gives a list of the characters in a string.

Details

  • Each character is given as a length one string.
  • Characters handles both ordinary and special characters.
  • Characters has attribute Listable.

Examples

open allclose all

Basic Examples  (1)

Break a string into a list of characters:

Show in InputForm:

Reassemble the string:

Scope  (2)

Characters handles special characters just like ordinary ones:

Characters threads itself element-wise over lists:

Applications  (4)

Break a string into overlapping trigrams:

Reassemble into strings:

Sort the characters in a string:

Find their frequencies:

Rotate the characters in a string:

Make an array out of a list of strings:

Properties & Relations  (1)

Characters gives a list of strings of length 1:

Possible Issues  (3)

A string form of an expression must be created before it can be broken into characters:

Characters operates on the explicit character form of strings:

Characters normally treats special characters just like other characters:

Use ToString and FullForm to get the characters in the full names of special characters:

Introduced in 1988
 (1.0)
 |
Updated in 1996
 (3.0)