[MonkeyScript] [TitleIndex] [WordIndex

   1 string.split('string'); // split a string appart by strings
   2 string.split('string', limit); // limit the number of strings returned discarding extras
   3 'foo,bar,baz'.split(','); // ["foo", "bar", "baz"]
   4 'foo,bar,baz'.split(',', 2); // ["foo", "bar"]
   5 string.split(/regex/, [limit]); // use a regex to split the string instead
   6 string.explode('string', limit); // .split more similar to php's explode() ie don't discard extras
   7 'foo,bar,baz'.explode(',', 2); // ["foo", "bar,baz"]
   8 'key=val=var'.explode('=', 2); // ["key", "val=var"]
   9 
  10 string.partition(separator);
  11 string.rpartition(separator);
  12 
  13 string.substitute(obj); // Substitute {key}'s inside of string with values from obj
  14 
  15 string.repeat(num); // return a string with the string repeated a number of times
  16 string.expand(length); // expand a string to a certain length repeating the string;
  17 'foobarbaz'.expand(13); // 'foobarbazfoob'
  18 
  19 string.chop(length); // return a string with the end chopped off if it's past the specified length
  20 'foobarbaz'.chop(5); // 'fooba'
  21 
  22 string.contains(string); // check if one string contains another
  23 string.indexOf(string, [offset]); // check the index of another string within this string
  24 string.lastIndexOf(string, [offset]); // check the index of the last occurence of another string within this string
  25 string.startsWith(string); // check if a string starts with another
  26 string.endsWith(string); // check if a string ends with another
  27 
  28 string.trim([chars]);
  29 string.ltrim([chars]);
  30 string.rtrim([chars]);
  31 
  32 string.lpad(len, [chars]);
  33 string.rpad(len, [chars]);
  34 
  35 string.lc; // shortcut for .toLowerCase()
  36 string.uc; // shortcut for .toUpperCase()
  37 string.ucfirst;
  38 string.lcfirst;
  39 
  40 string.reverse(); // return a string with this string's characters in reverse
  41 

2010-07-23 04:25