strings/ | |
License | Copyright © 2007-2011, FreeBASIC Extended Library Development Group |
ext. | |
Functions | |
Repeat | Returns a string of length n consisting of as many characters with the ascii code ascii_code. |
Repeat | Returns a string of length n * len(subject) consisting of consecutive copies of subject. |
Replace | Replaces all unique occurences of oldtext found within subject, from beginning to end, and replaces them with newtext. |
Replace | Replaces all unique occurrences of each of the strings in oldtext, in order, that are found within subject, with newtext. |
Replace | Replaces all unique occurrences of each of the strings in oldtext, in order, that are found within subject, with corresponding strings in newtext, or the empty string (“”) if there are no corresponding strings. |
Replace | Replaces all unique occurrences of oldtext, that are found within each of the strings in subject, with newtext. |
Replace | Replaces all unique occurrences of each of the strings in oldtext, in order, that are found within each of the strings in subject, with newtext. |
Replace | Replaces all unique occurrences of each of the strings in oldtext, in order, that are found within each of the strings in subject, with corresponding strings from newtext, or the empty string (“”) if there are no corresponding strings. |
ReplaceCopy | Returns a copy of subject with all unique occurrences of oldtext replaced with newtext. |
ReplaceCopy | Returns a copy of subject with all unique occurrences of each of the strings in oldtext, in order, with newtext. |
ReplaceCopy | Returns a copy of subject with all unique occurrences of each of the strings in oldtext replaced by corresponding strings in newtext. |
ReplaceCopy | Assigns the strings in result the value of the corresponding strings in subject with each unique occurrence of oldtext, found from beginning to end, with newtext. |
ReplaceCopy | Assigns the strings in result, starting with string at index, the value of the corresponding strings in subject with each unique occurrence of oldtext, found from beginning to end, with newtext. |
ReplaceCopy | |
ReplaceCopy | |
Reverse | Reverses the order of the characters in subject. |
Reverse | Reverses the order of the characters in each of the strings in subject. |
ReverseCopy | Returns a copy of subject with the order of the characters reversed. |
ReverseCopy | Assigns the strings in result the values of the corresponding strings in subject with the order of the characters in each string reversed. |
ReverseCopy | Assigns the strings in result, starting with the string at index, the values of the corresponding strings in subject, starting with the first string, with the order of the characters in each string reversed. |
Rot13 | The ROT13 encoding simply shifts every letter by 13 places in the alphabet while leaving non-alpha characters untouched. |
Rot13Copy | The ROT13 encoding simply shifts every letter by 13 places in the alphabet while leaving non-alpha characters untouched. |
shuffle | Randomly shuffles the characters in the string. |
Shuffle | Randomly shuffles the characters in each of an array of strings. |
ShuffleCopy | Randomly shuffles the characters in the string. |
ShuffleCopy | Randomly shuffles the characters in each of an array of strings. |
UCWords | Capitalizes every word in a string. |
UCWordsCopy | Capitalizes every word in a string. |
Copyright © 2007-2011, FreeBASIC Extended Library Development Group
Distributed under the FreeBASIC Extended Library Group license. See accompanying file LICENSE.txt or copy at http://code.google.com
Functions | |
Repeat | Returns a string of length n consisting of as many characters with the ascii code ascii_code. |
Repeat | Returns a string of length n * len(subject) consisting of consecutive copies of subject. |
Replace | Replaces all unique occurences of oldtext found within subject, from beginning to end, and replaces them with newtext. |
Replace | Replaces all unique occurrences of each of the strings in oldtext, in order, that are found within subject, with newtext. |
Replace | Replaces all unique occurrences of each of the strings in oldtext, in order, that are found within subject, with corresponding strings in newtext, or the empty string (“”) if there are no corresponding strings. |
Replace | Replaces all unique occurrences of oldtext, that are found within each of the strings in subject, with newtext. |
Replace | Replaces all unique occurrences of each of the strings in oldtext, in order, that are found within each of the strings in subject, with newtext. |
Replace | Replaces all unique occurrences of each of the strings in oldtext, in order, that are found within each of the strings in subject, with corresponding strings from newtext, or the empty string (“”) if there are no corresponding strings. |
ReplaceCopy | Returns a copy of subject with all unique occurrences of oldtext replaced with newtext. |
ReplaceCopy | Returns a copy of subject with all unique occurrences of each of the strings in oldtext, in order, with newtext. |
ReplaceCopy | Returns a copy of subject with all unique occurrences of each of the strings in oldtext replaced by corresponding strings in newtext. |
ReplaceCopy | Assigns the strings in result the value of the corresponding strings in subject with each unique occurrence of oldtext, found from beginning to end, with newtext. |
ReplaceCopy | Assigns the strings in result, starting with string at index, the value of the corresponding strings in subject with each unique occurrence of oldtext, found from beginning to end, with newtext. |
ReplaceCopy | |
ReplaceCopy | |
Reverse | Reverses the order of the characters in subject. |
Reverse | Reverses the order of the characters in each of the strings in subject. |
ReverseCopy | Returns a copy of subject with the order of the characters reversed. |
ReverseCopy | Assigns the strings in result the values of the corresponding strings in subject with the order of the characters in each string reversed. |
ReverseCopy | Assigns the strings in result, starting with the string at index, the values of the corresponding strings in subject, starting with the first string, with the order of the characters in each string reversed. |
Rot13 | The ROT13 encoding simply shifts every letter by 13 places in the alphabet while leaving non-alpha characters untouched. |
Rot13Copy | The ROT13 encoding simply shifts every letter by 13 places in the alphabet while leaving non-alpha characters untouched. |
shuffle | Randomly shuffles the characters in the string. |
Shuffle | Randomly shuffles the characters in each of an array of strings. |
ShuffleCopy | Randomly shuffles the characters in the string. |
ShuffleCopy | Randomly shuffles the characters in each of an array of strings. |
UCWords | Capitalizes every word in a string. |
UCWordsCopy | Capitalizes every word in a string. |
declare function Repeat overload ( byval ascii_code as integer, byval n as integer ) as string
Returns a string of length n consisting of as many characters with the ascii code ascii_code.
ascii_code | the ascii code of the character to repeat |
n | the number of times to repeat ascii_code |
string containing the repeated ascii_code
declare function Repeat ( byref subject as const string, byval n as integer ) as string
Returns a string of length n * len(subject) consisting of consecutive copies of subject.
subject | the string to repeat. |
n | the number of times to repeat subject |
The string containing the repeated subject
declare sub Replace overload ( byref subject as string, byref oldtext as const string, byref newtext as const string )
Replaces all unique occurences of oldtext found within subject, from beginning to end, and replaces them with newtext.
subject | the text to search and replace in. |
oldtext | text to search for in the string. |
newtext | text to replace oldtext with |
If the length of either subject or oldtext is zero (0), ext.strings.Replace does nothing.
declare sub Replace ( byref subject as string, oldtext() as const string, byref newtext as const string )
Replaces all unique occurrences of each of the strings in oldtext, in order, that are found within subject, with newtext.
subject | the text to search and replace in. |
oldtext() | the array of strings to search for. |
newtext | the string to replace oldtext() with. |
For every string i in [lbound(oldtext), ubound(oldtext)],
ext.strings.Replace(subject, oldtext(i), newtext)
is called.
declare sub Replace ( byref subject as string, oldtext() as const string, newtext() as const string )
Replaces all unique occurrences of each of the strings in oldtext, in order, that are found within subject, with corresponding strings in newtext, or the empty string (“”) if there are no corresponding strings.
subject | the string to search and replace in. |
oldtext() | the array of strings to search for. |
newtext() | the array of strings to replace with. |
For every string i in [lbound(oldtext), lbound(oldtext) + n-1], where n is the minimum size between oldtext and newtext,
ext.strings.Replace(subject, oldtext(i), newtext(i))
is called. If oldtext contains more strings to find as there are replcements in newtext, then for every string i in [n-1, ubound(oldtext)],
ext.strings.Replace(subject, oldtext(i), "")
is called.
declare sub Replace ( subject() as string, byref oldtext as const string, byref newtext as const string )
Replaces all unique occurrences of oldtext, that are found within each of the strings in subject, with newtext.
subject() | string array to search and replace in. |
oldtext | text to search for. |
newtext | text to replace with. |
For every string i in [lbound(subject), ubound(subject)],
ext.strings.Replace(subject(i), oldtext, newtext)
is called.
declare sub Replace ( subject() as string, oldtext() as const string, byref newtext as const string )
Replaces all unique occurrences of each of the strings in oldtext, in order, that are found within each of the strings in subject, with newtext.
subject() | string array to search and replace in. |
oldtext() | array of strings to search for. |
newtext | string to replace with. |
For every string i in [lbound(subject), ubound(subject)],
ext.strings.Replace(subject(i), oldtext(), newtext)
is called.
declare sub Replace ( subject() as string, oldtext() as const string, newtext() as const string )
Replaces all unique occurrences of each of the strings in oldtext, in order, that are found within each of the strings in subject, with corresponding strings from newtext, or the empty string (“”) if there are no corresponding strings.
subject() | string array to search and replace in. |
oldtext() | array of strings to search for. |
newtext() | array of strings to replace with. |
For every string i in [lbound(subject), ubound(subject)],
ext.strings.Replace(subject(i), oldtext(), newtext())
is called.
declare function ReplaceCopy overload ( byref subject as const string, byref oldtext as const string, byref newtext as const string ) as string
Returns a copy of subject with all unique occurrences of oldtext replaced with newtext.
subject | the text to search in |
oldtext | text to search for in the string. |
newtext | text to replace oldtext with |
Behaves like,
var tmp = subject ext.strings.Replace(tmp, oldtext, newtext) return tmp
declare function ReplaceCopy ( byref subject as const string, oldtext() as const string, byref newtext as const string ) as string
Returns a copy of subject with all unique occurrences of each of the strings in oldtext, in order, with newtext.
subject | the text to search. |
oldtext() | the array of strings to search for. |
newtext | the string to replace with. |
Behaves like,
var tmp = subject ext.strings.Replace(tmp, oldtext(), newtext) return tmp
declare function ReplaceCopy ( byref subject as const string, oldtext() as const string, newtext() as const string ) as string
Returns a copy of subject with all unique occurrences of each of the strings in oldtext replaced by corresponding strings in newtext.
subject | the string to search. |
oldtext() | the array of strings to search for. |
newtext() | the array of strings to replace with. |
Behaves like,
var tmp = subject ext.strings.Replace(tmp, oldtext(), newtext()) return tmp
declare sub ReplaceCopy ( subject() as const string, byref oldtext as const string, byref newtext as const string, result() as string )
Assigns the strings in result the value of the corresponding strings in subject with each unique occurrence of oldtext, found from beginning to end, with newtext. result is resized occordingly.
subject() | array of string to search. |
oldtext | text to search for. |
newtext | string to replace with. |
result() | variable-length string array to store results. |
Behaves like,
redim result(lbound(subject), ubound(subject)) as string for i as integer = lbound(subject) to ubound(subject) result(i) = ext.strings.Replace(subject(i), oldtext, newtext) next i
declare sub ReplaceCopy ( subject() as const string, byref oldtext as const string, byref newtext as const string, result() as string, byval index as integer )
Assigns the strings in result, starting with string at index, the value of the corresponding strings in subject with each unique occurrence of oldtext, found from beginning to end, with newtext. result is assumed to be large enough.
subject() | array of string to search. |
oldtext | text to search for. |
newtext | string to replace with. |
result() | variable-length string array to store results. |
index | starting index of result array. |
Behaves like,
redim result(lbound(subject), ubound(subject)) as string for i as integer = lbound(subject) to ubound(subject) result(i) = ext.strings.Replace(subject(i), oldtext, newtext) next i
declare sub ReplaceCopy ( subject() as const string, oldtext() as const string, byref newtext as const string, result() as string )
subject() | array of string to search. |
oldtext() | array of strings to search for. |
newtext | string to replace with. |
result() | string array to copy modifications to. |
Behaves like,
redim result(lbound(subject), ubound(subject)) as string for i as integer = lbound(subject) to ubound(subject) result(i) = ext.strings.Replace(subject(i), oldtext(), newtext) next i
declare sub ReplaceCopy ( subject() as const string, oldtext() as const string, newtext() as const string, result() as string )
subject() | array of string to search. |
oldtext() | array of strings to search for. |
newtext() | array of strings to replace with. |
result() | string array to copy modifications to. |
Behaves like,
redim result(lbound(subject), ubound(subject)) as string for i as integer = lbound(subject) to ubound(subject) result(i) = ext.strings.Replace(subject(i), oldtext(), newtext()) next i
declare sub ReverseCopy ( subject() as const string, result() as string )
Assigns the strings in result the values of the corresponding strings in subject with the order of the characters in each string reversed. result is resized so that its upper and lower bounds are the same as subject
subject() | array of strings to reverse. |
result() | array of strings to return results in. |
For every n in [lbound(subject), ubound(subject)],
result(n) = ext.strings.Reverse(subject(n))
is called.
declare sub ReverseCopy ( subject() as const string, result() as string, byval index as integer )
Assigns the strings in result, starting with the string at index, the values of the corresponding strings in subject, starting with the first string, with the order of the characters in each string reversed. result is assumed to be large enough to hold ubound(subject)-lbound(subject)+1 number of strings.
subject() | array of strings to reverse. |
result() | array of strings to return results in. |
index | starting index of result array. |
For every n in [lbound(subject), ubound(subject)] and m in [index, index + (ubound(subject)-lbound(subject) + 1)],
result(m) = ext.strings.Reverse(subject(n))
declare sub Rot13 ( byref subject as string )
The ROT13 encoding simply shifts every letter by 13 places in the alphabet while leaving non-alpha characters untouched. Encoding and decoding are done by the same function, passing an encoded string as argument will return the original version.
subject | string to encode or decode. |
declare function Rot13Copy ( byref subject as const string ) as string
The ROT13 encoding simply shifts every letter by 13 places in the alphabet while leaving non-alpha characters untouched. Encoding and decoding are done by the same function, passing an encoded string as argument will return the original version.
subject | string to encode or decode. |
the modified string.
Returns a string of length n consisting of as many characters with the ascii code ascii_code.
declare function Repeat overload ( byval ascii_code as integer, byval n as integer ) as string
Replaces all unique occurences of oldtext found within subject, from beginning to end, and replaces them with newtext.
declare sub Replace overload ( byref subject as string, byref oldtext as const string, byref newtext as const string )
Returns a copy of subject with all unique occurrences of oldtext replaced with newtext.
declare function ReplaceCopy overload ( byref subject as const string, byref oldtext as const string, byref newtext as const string ) as string
Reverses the order of the characters in subject.
declare sub Reverse overload ( byref subject as string )
Returns a copy of subject with the order of the characters reversed.
declare function ReverseCopy overload ( byref subject as const string ) as string
The ROT13 encoding simply shifts every letter by 13 places in the alphabet while leaving non-alpha characters untouched.
declare sub Rot13 ( byref subject as string )
The ROT13 encoding simply shifts every letter by 13 places in the alphabet while leaving non-alpha characters untouched.
declare function Rot13Copy ( byref subject as const string ) as string
Randomly shuffles the characters in each of an array of strings.
declare sub Shuffle ( subject() as string )
Randomly shuffles the characters in the string.
declare function ShuffleCopy overload ( byref subject as const string ) as string
Capitalizes every word in a string.
declare sub UCWords ( byref subject as string )
Capitalizes every word in a string.
declare function UCWordsCopy ( byref subject as const string ) as string