Thread: Tokens?
View Single Post
  #2  
Old 02-24-2011, 01:52 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Syntax: string.tokenize([delimiter])

delimiter - (Optional) string to break the string into tokens by, if you don't specify a delimiter it will be break it apart based on a space.

Examples:

PHP Code:
function onCreated() {
  
// Tokenize string with no passed delimiter.
  
temp.str "Hello World!";
  
temp.tokens temp.str.tokenize();
  echo(
"tokens[0]" SPC temp.tokens[0]);
  echo(
"tokens[1]" SPC temp.tokens[1]);

  
// Tokenize string with # passed as the delimiter.
  
temp.str "Hello#World!";
  
temp.tokens temp.str.tokenize("#");
  echo(
"tokens[0]" SPC temp.tokens[0]);
  echo(
"tokens[1]" SPC temp.tokens[1]);

__________________
Quote:
Reply With Quote