StringUtils
Download StringUtils 1.9
StringUtils is a module for REALbasic that adds a variety of highly useful string-related functions:
- Chop: Return s with the rightmost ‘charsToCut’ chars removed.
- ChopB: Return s with the rightmost ‘bytesToCut’ bytes removed.
- Contains: Returns true if ’s’ contains substring ‘what’.
- ContainsB: Return true if ’s’ contains the substring ‘what’.
- ControlCharacters: Return the control character region of the ASCII set, i.e. ASCII 0 through 31.
- Count: Return how many non-overlapping occurrences of ’substr’ there are in ’source’.
- CountB: Return how many non-overlapping occurrences of ’substr’ there are in ’source’, doing binary comparison.
- CountFieldsQuoted: Equivalent to RB’s CountFields() function, but respects quoted values.
- CountRegEx: Count the number of occurrences of a RegEx pattern within a string.
- DecimalSeparator: Return the decimal separator the user uses (either “.” or “,”).
- DecodeCase: This function undoes the encoding of case done by EncodeCase, resulting in the original string.
- EditDistance: Return the Levenshtein distance, aka the edit distance, between the two strings.
- EncodeCase: Return a version of the given string that encodes the uppercase/lowercase state of each letter as follows: every time we switch from uppercase to lowercase, we insert a “^”. A “^” in the original string will be represented as “^^”. Finally, we will assume lowercase at the beginning of the string (so an initial capital letter will be preceded by “^”).
- EndsWith: Return true if ’s’ ends with the string ‘withWhat’, doing a standard string comparison.
- EndsWithB: Return true if ’s’ ends with the string ‘withWhat’, doing a binary comparison.
- GuessEncoding:
- Hash
- HexB
- InStrQuoted
- InStrReverse
- InStrReverseB
- IsEmpty
- JoinQuoted
- LineEnding
- LTrim
- MatchCase
- Metaphone
- NthFieldQuoted
- PadBoth
- PadLeft
- PadRight
- Random
- Remove
- Repeat
- ReplaceRange
- ReplaceRangeB
- Reverse
- ReverseB
- RTrim
- Soundex
- SplitByLength
- SplitByLengthB
- SplitByRegEx
- SplitQuoted
- SplitToCDbl
- SplitToInt
- SplitToVal
- Sprintf
- SQLify
- Squeeze
- SqueezeB
- StartsWith
- StartsWithB
- SwapBytePairs
- SwapByteQuads
- ThousandsSeparator
- Trim
- WrapLines
Many people have contributed to the development of this module, including:
Frank Bitterlich, bitterlich@gsco.de
Ben Blake, benb@kagi.com
Cortis Clark, cortis@realsoftware.com
Carlos Martinho, rblists@rbtips.com
Jon Johnson, jonj@realsoftware.com
Joe Strout, joe@strout.net (*)
Florent Pillet, florent@florentpillet.com
Kem Tekinay, ktekinay@mactechnologies.com
Charles Yeomans, yeomans@desuetude.com

