Let's say we have a string:
mystr = "my,name,is,starfruitbob"
word( <number here>, <what I'm processing>, <all delimiters, in string format> )
In my opinion, it's best to learn what each of these do slightly out of order:
- <what I'm processing> : This could be a string variable or column, for example. This is the input. Must be character type.
- <delimiter> : "string things here!" <-- put all of the delimiters you wish in here. EACH of them, individually, will be used as a delimiter, even if you put a space in there!
- <number here> : Depending how you're delimiting your input, it will be separated into different "chunks". The number is what "chunk" you want to return.
Let's look at an example:
mystr = "my,name,is,starfruitbob";
// Note where the commas are in the variable above
print( word( 1, mystr, "," ) ); // Returns: my
print( word( 3, mystr, "," ) ); // Returns: is
// If the delimiter is changed...
print( word( 1, mystr, "s" ) ); // Returns: my,name,i
// This is because it will return the first characters BEFORE the new delimiter "s"
print( word( 2, mystr, "s" ) ); // Returns: ,
// There's only a single comma between the two "s" delimiters, and is the second "chunk" of the input
Does this help @BunnyBoi12
Learning every day!