Finally including tokenizer, trim and replace functions
alert("Cats and birds and cows and mice.".replace(/and/g, "or"));
But not everybody is familiar with regular expressions, and it requires some time until one has learnt all the possibilities regular expressions offer. This is why Turboid provides the function replaceStrings(searchTerm, replacingTerm, sentence).
Below you find a list of Turboid string analyzing and manipulating functions:
replaceStrings(searchTerm, replacingTerm, sentence)
Replaces searchTerm by replacingTerm in sentence. If written replaceString() (without "s"), it replaces only the first occurence. The function is case sensitive. sentence would be returned unchanged if searchTerm has not been found. In order to work without case sensitivity, use replaceWords() or replaceWord().
replaceAt(pos, replacement, sentence)
Overwrites a part of sentence by replacement at pos (number value), which is the index of the character which the overwriting is supposed to start at. The part being overwritten has the length of the string passed in replacement.
Cuts away white spaces at the beginning and the end of str.
Reduces each multiple white space to a single white space. Useful especially for user inputs.
tokenize(str, delimiter_1 [, delimiter_2, delimiter_3, ...])
Devides str by the passed delimiter(s) into parts and returns them as an array. This is one of the most useful string functions.
Returns a string (str) with the first letter set to upper case.
Returns whether str is upper case or not.
Generates a random string, with length as the number of letters.
Returns whether a string (emailadress) is written in e-mail format, e.g. "firstname.lastname@example.org".
Returns the number of occurences of searchTerm in sentence.
In order to use these extra functions, simply download the free Turboid framework and put it into the directory of your HTML file, then write this line into the head section of your HTML file, and that's it: