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  (2)

Characters gives a list of strings of length 1:

Characters splits characters composed of multiple codes into their individual codes:

Also, some emoji characters will break apart into their constituent parts:

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:

Wolfram Research (1988), Characters, Wolfram Language function, https://reference.wolfram.com/language/ref/Characters.html (updated 1996).

Text

Wolfram Research (1988), Characters, Wolfram Language function, https://reference.wolfram.com/language/ref/Characters.html (updated 1996).

CMS

Wolfram Language. 1988. "Characters." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 1996. https://reference.wolfram.com/language/ref/Characters.html.

APA

Wolfram Language. (1988). Characters. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Characters.html

BibTeX

@misc{reference.wolfram_2023_characters, author="Wolfram Research", title="{Characters}", year="1996", howpublished="\url{https://reference.wolfram.com/language/ref/Characters.html}", note=[Accessed: 19-March-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_characters, organization={Wolfram Research}, title={Characters}, year={1996}, url={https://reference.wolfram.com/language/ref/Characters.html}, note=[Accessed: 19-March-2024 ]}