ParseString()

Summary

Divides a string into pieces separated by the specified delimiters.

Syntax

pieces = ParseString(string s, string delimiters [, array options])

Argument Contents
s The string that is split
delimiters A string containing all the delimiter characters
Option Type Contents
Include Empty Boolean If "True" each delimiter in s is treated as a separator; if "False" (default) multiple separators in a row in s are treated as one separator

Returns

An array of the delimited strings, or null if either s or delimiters is null.

Notes

  • If s contains none of the characters in delimiters, then the return value is an array of one string.

  • Each character in delimiters is always considered a delimiter character, so you cannot split strings using a multi-character separator.

  • ParseString() does not include any of the delimiter characters in the strings that make up the returned array.

  • If you set the Include Empty option to "True" the return array will include null entries if there are adjacent delimiters or delimiters at the beginning or the end of the string, and the number of array elements always matches the number of delimiters plus one.

Examples

subs = ParseString("Aaron LaClair Brandon", " ")
// returns {"Aaron", "LaClair", "Brandon"}
subs = ParseString("The quick brown fox jumped", "u b")
// returns {"The", "q", "ick", "rown", "fox", "j", "mped"}
subs = ParseString("b12b34bbb56","b")
// returns {"12", "34", "56"}
opts = {}
opts.[Include Empty] = "True"
subs = ParseString("b12b34bbb56","b", opts)
// returns {null, "12", "34", null, null, "56"}

See Also

Function Summary
CompareStrings() Compares two strings to see if they match
JoinStrings() Returns a concatenated string separated by the delimiter
SplitString() Divides a string into pieces based on the position of vertical bars (|) in that string
Word() Extracts one word from a string