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, 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 leading and trailing white spaces from the input string.
  3. If the input string does not contain the delimiter character, NxTokenize returns a #VALUE! error.
  4. If the order value is greater than the number of tokens in the string, NxTokenize returns a #VALUE! error.

Examples

Example 1:

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

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