NxTokenize - Separate a string by a delimiter into an array of substrings

Returns the n-th token/sub-string in a string after splitting it using a given delimiter.

Syntax

NxTokenize(String, Delimiter, Order)

String
is the input string to match for.
Delimiter
is the character to use for splitting the string. If missing, a comma (,) is used.
Order
is the order of the token to return, where first = 1, second = 2, ..., and last = -1. If missing, the first token is returned.

Remarks

  1. The delimiter may contain any number of characters, but only the first one is used.
  2. The NxTokenize function trims the input string's leading and trailing white spaces.
  3. If the input string does not contain the delimiter character, NxTokenize returns a #VALUE! error.
  4. If the order value exceeds the number of tokens in the string, NxTokenize returns a #VALUE! error.

Examples

Formula Description (Result)
=NxTokenize("this is a string"," ",1) this
=NxTokenize("this is a string"," ",4) string
=NxTokenize("find/the/substring","/") find
=NxTokenize("gu!ess}the/del-imet!er","!",2) ess}the/del-imet

Files Examples

Related Links

References

  • Jeffrey E.F. Friedl (2006). Mastering Regular Expressions (3rd edition). Oreilly Media. ISBN 0-596-52812-4.

Comments

Article is closed for comments.

Was this article helpful?
0 out of 0 found this helpful