by TrashHalo
String manipulation functions
Dec 23, 2:31pm ~
Fix the bug in wordwrap. Also now trim removes tabs also.
Dec 23, 1:59am ~
I am aware of a bug in wordwrap, where if certain things occur it prints a single extra endline. I will fix it tomarrow.

--Tokenizer class--
Used to split a string by a specified pattern over time. Unlike a classic function such as split which actually splits the string into a array this just returns the string for one element at a time. I feel this is much more efficient. This is a seriously stripped down version of java's tokenizer.
example of use:
while(t.more() !=0)
world <<

startsWith(base as text,find as text)
--Trys to find a pattern at the begining of a string.
endsWith(base as text,find as text)
--Trys to find a pattern at the end of a string.
trim(base as text)
--Removes leading and trailing whitespace from a string.
charAt(base as text,at as num)
--Returns a character in a string at a specific index.
replace(base as text,find as text,replace as text)
--Replaces all instances of a pattern with another string.
chomp(base as text)
--Removes the final character of a string only if its a end-line.
chop(base as text)
--Removes the final character of a string.
join(token as text,base[])
--Converts a array of strings into a single string placing a
--specified pattern between the elements of the array
split(token as text,base as text)
--Opposite of join; creates a array of strings form a single
--string, using a pattern as the breaking point
toCharArray(base as text)
--Converts a string into a array of characters
wordWrap(base as text,numChars as num)
--Inserts endlines every so many characters. The limit is set via
--numChars and it will not devide a word in half it back pedals to
--a space and inserts it there. During testing it moved through a 40k
--string in a average of 5 miliseconds.
count(base as text,token as text)
--Counts the number of instances of a specified pattern that exist in
--a string
reverse(base as text)
--Reverses a string of characters. I cant reccomend doing this to
--anything bigger than 10000 characters. During tests it took about
--10 miliseconds to push through a stack that big.

Icon is from nuvola 1.0</<>