WLJS LogoWLJS Notebook

StringExtract

StringExtract["string", n] extracts the nth block of characters in string, where blocks of characters are defined as delimited by whitespace.

  • StringExtract["string", {pos1, pos2, ...}] extracts blocks at several positions in string.
  • StringExtract["string", sep -> pos] takes blocks to be delimited by separators that match sep.
  • StringExtract["string", pos1, pos2, ...] extracts blocks at positions posi, delimiting with whitespace for the lowest level, newlines for the next level.
  • StringExtract["string", sep1 -> pos1, sep2 -> pos2, ...] gives a nested list of blocks, with the sepi used as separators for successive levels.

Examples

StringExtract["one two three", 2]
StringExtract["a,b,c", "," -> 2]

Please visit the official Wolfram Language Reference for more details.

On this page