$strtok

By Firstmate on Oct 24, 2008

Usage: $strtok(Text,Tokens,C)
Returns the number of times each word in Token, separated by C appears in Text.

e.g. $strtok(This is a test, test is, 32)
Returns 2 because test appears once and is appears once
Or $strtok(The the the the test, the test, 32)
Returns 5

Edit: Changed to a regex. (Thanks Imrac)

alias strtok { return $regex($1,/\b( $+ $replace($iif($$3 != 124,$replace($2,$chr(124),\ $+ $chr(124)),$2),$chr($3),$chr(124)) $+ )\b/gi) }

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.