XString.bi | |
License | Copyright © 2009, FreeBASIC Extended Library Development Group |
ext. strings | |
Enumerations | |
PAD_OPTION | |
XString | Implements: Comparable, Equatable, Printable, Assignable |
Functions | |
default cosntructor | Constructs an XString |
operator let | Assigns the value of another XString |
operator += | Appends the value of an XString |
operator &= | Appends the value of an XString |
operator -= | Removes all occurances of a substring |
operator *= | Appends the value of the XString a number of times |
Empty | Returns ext.true if empty, ext.false otherwise |
Len | Returns the length, in characters. |
Trim | Trims whitespace from both sides of the XString object |
LTrim | Trims whitespace from the left side of a XString object |
RTrim | Trims whitespace from the right side of a XString object |
Instr | Searchs a string for the first occurence of a substring |
UCase | Transforms the alphabetical characters into uppercase |
LCase | Transforms the alphabetical characters into lowercase |
Left | Returns a string of length characters from the left side of the XString object |
Right | Returns a string of length characters from the right side of the XString object |
Mid | Performs an in-object text replace |
Mid | Retrieves a portion of the XString object. |
Replace | Replaces a substring with a string you provide |
Replace | Replaces an array of substrings in a XString object |
Replace | Replaces an array of substrings in a XString object |
UCFirst | Capitalizes the first letter in the XString object |
LCFirst | Makes the first letter in the XString object lower case |
Pad | Pads a XString object with another string, similiar to php’s str_pad |
PadCopy | Pads a XString object with another string, similiar to php’s str_pad |
Rot13 | Performs a rot13 rotation on a XString object |
Rot13Copy | Performs a rot13 rotation on a XString object |
CRC32 | Calculates the 32 bit Cyclic Redundancy Check of a XString object and replaces the string with the hexidecimal representation of the CRC |
CRC32Copy | Calculates the 32 bit Cyclic Redundancy Check of a XString object |
ReplaceCopy | Performs a text substitution in the XString object |
ReplaceCopy | Performs a text substitution in a XString object |
ReplaceCopy | Performs a text substitution in a XString object |
Explode | Splits the string into an array. |
Split | Splits the string into an array. |
Shuffle | Randomly shuffles the characters in the string. |
shuffleCopy | Randomly shuffles the characters in the string |
Substr | Returns a portion of a string. |
Substr | Returns a portion of a string. |
SubstrCompare | Compares a portion of an XString with another. |
SubstrCompare | Compares a portion of an XString with another. |
SubstrCount | Finda the number of strings contained in the XString. |
SubstrCount | Finda the number of strings contained in the XString. |
SubstrReplace | Replaces a portion of the XString with another. |
SubstrReplace | Replaces a portion of the XString with another. |
Pos | Find the position of a string in the object |
Repeat | Repeats the string a certain number of times. |
Reverse | Reverses the string in-place. |
ReverseCopy | Reverses the string. |
ucwords | Capitalizes every word in the string. |
ucwordsCopy | Capitalizes every word in the string. |
Copyright © 2009, 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- /p- /fb-extended-lib- /wiki- /License
Implements: Comparable, Equatable, Printable, Assignable
Enhanced string type fully compatible with standard strings.
Supports the use of the +, &, -(Subtract a substring), -(Negate or reverse) and the * (repetition of the string) operators.
Functions | |
default cosntructor | Constructs an XString |
operator let | Assigns the value of another XString |
operator += | Appends the value of an XString |
operator &= | Appends the value of an XString |
operator -= | Removes all occurances of a substring |
operator *= | Appends the value of the XString a number of times |
Empty | Returns ext.true if empty, ext.false otherwise |
Len | Returns the length, in characters. |
Trim | Trims whitespace from both sides of the XString object |
LTrim | Trims whitespace from the left side of a XString object |
RTrim | Trims whitespace from the right side of a XString object |
Instr | Searchs a string for the first occurence of a substring |
UCase | Transforms the alphabetical characters into uppercase |
LCase | Transforms the alphabetical characters into lowercase |
Left | Returns a string of length characters from the left side of the XString object |
Right | Returns a string of length characters from the right side of the XString object |
Mid | Performs an in-object text replace |
Mid | Retrieves a portion of the XString object. |
Replace | Replaces a substring with a string you provide |
Replace | Replaces an array of substrings in a XString object |
Replace | Replaces an array of substrings in a XString object |
UCFirst | Capitalizes the first letter in the XString object |
LCFirst | Makes the first letter in the XString object lower case |
Pad | Pads a XString object with another string, similiar to php’s str_pad |
PadCopy | Pads a XString object with another string, similiar to php’s str_pad |
Rot13 | Performs a rot13 rotation on a XString object |
Rot13Copy | Performs a rot13 rotation on a XString object |
CRC32 | Calculates the 32 bit Cyclic Redundancy Check of a XString object and replaces the string with the hexidecimal representation of the CRC |
CRC32Copy | Calculates the 32 bit Cyclic Redundancy Check of a XString object |
ReplaceCopy | Performs a text substitution in the XString object |
ReplaceCopy | Performs a text substitution in a XString object |
ReplaceCopy | Performs a text substitution in a XString object |
Explode | Splits the string into an array. |
Split | Splits the string into an array. |
Shuffle | Randomly shuffles the characters in the string. |
shuffleCopy | Randomly shuffles the characters in the string |
Substr | Returns a portion of a string. |
Substr | Returns a portion of a string. |
SubstrCompare | Compares a portion of an XString with another. |
SubstrCompare | Compares a portion of an XString with another. |
SubstrCount | Finda the number of strings contained in the XString. |
SubstrCount | Finda the number of strings contained in the XString. |
SubstrReplace | Replaces a portion of the XString with another. |
SubstrReplace | Replaces a portion of the XString with another. |
Pos | Find the position of a string in the object |
Repeat | Repeats the string a certain number of times. |
Reverse | Reverses the string in-place. |
ReverseCopy | Reverses the string. |
ucwords | Capitalizes every word in the string. |
ucwordsCopy | Capitalizes every word in the string. |
declare function Instr ( byval start as integer = 0, byref search as const string ) as integer
Searchs a string for the first occurence of a substring
start | integer value specifying what character position in the string to start the search at. |
search | string or XString value specifying the substring to search for. |
Integer value reflecting the character postition of the first occurence of substring.
declare function Mid ( byval start as integer, byval length as integer = 0 ) as string
Retrieves a portion of the XString object.
start | character position to start at |
length | length of string to return, 0 for up to length of XString object |
A string containing up to length characters from the XString object
declare sub Pad ( byval length as integer, byref pad_str as const string = " ", byval opt as PAD_OPTION = STR_PAD_RIGHT )
Pads a XString object with another string, similiar to php’s str_pad
length | Final length the string must reach |
pad_str | The string to pad the XString object with |
opt | Optional Padding behaviour, defaults to <STR_PAD_RIGHT> |
declare const function PadCopy ( byval length as integer, byref pad_str as const string = " ", byval opt as PAD_OPTION = STR_PAD_RIGHT ) as XString
Pads a XString object with another string, similiar to php’s str_pad
length | Final length the string must reach |
pad_str | The string to pad the XString object with |
opt | Optional Padding behaviour, defaults to <STR_PAD_RIGHT> |
Padded string.
declare function Explode ( byref delimit as const string, res() as string ) as integer
Splits the string into an array.
delimit | The delimiter to use when splitting the array, only first character is used. |
res() | string array that results will be passed into. |
Integer number of delimited strings found.
declare function Split ( result() as string, byref delimiter as const string, byval limit as integer ) as integer
Splits the string into an array.
result() | string array for results. |
delimiter | the delimiter to use when splitting the string. |
limit | the maximum number of strings to split into. |
Integer number of delimited strings found.
declare function Substr ( byval offset as integer, byval length as integer ) as XString
Returns a portion of a string.
offset | zero-based offset of substring. if negative, specifies (-offset) chars from the end of the string |
length | the number of characters from offset to include. if negative, specifies all but the remaining (-length) characters. |
The requested sub string.
declare const function SubstrCompare ( byref b as const string, byval offset as integer = 0 ) as integer
Compares a portion of an XString with another.
b | A string. |
offset | zero-based offset of substring. if negative, specifies (-offset) chars from the end of the string |
Returns a negative, zero or positive value if the substring is less than, equal to or greater than b.
declare const function SubstrCompare ( byref b as const string, byval offset as integer, byval length as integer ) as integer
Compares a portion of an XString with another.
b | A string. |
offset | zero-based offset of substring. if negative, specifies (-offset) chars from the end of the string |
length | the number of characters from offset to include. if negative, specifies all but the remaining (-length) characters. |
Returns a negative, zero or positive value if the substring is less than, equal to or greater than b.
declare const function SubstrCount ( byref needle as const string, byval offset as integer = 0 ) as integer
Finda the number of strings contained in the XString.
needle | substring to search for |
offset | zero-based offset of substring. if negative, specifies (-offset) chars from the end of the string |
The number of substrings found.
declare const function SubstrCount ( byref needle as const string, byval offset as integer, byval length as integer ) as integer
Finda the number of strings contained in the XString.
needle | substring to search for |
offset | zero-based offset of substring. if negative, specifies (-offset) chars from the end of the string |
length | the number of characters from offset to include. if negative, specifies all but the remaining (-length) characters. |
The number of substrings found.
declare sub SubstrReplace ( byref replacement as const string, byval offset as integer, byval length as integer )
Replaces a portion of the XString with another.
replacement | replacement string |
offset | zero-based offset of substring. if negative, specifies (-offset) chars from the end of the string |
length | the number of characters from offset to include. if negative, specifies all but the remaining (-length) characters. |
declare const function Pos ( byref needle as const string, byval offset as integer = 0 ) as integer
Find the position of a string in the object
needle | the string to search for. |
offset | zero-based offset of substring. if negative, specifies (-offset) chars from the end of the string |
The first index of the found string.
Assigns the value of another XString
declare operator let ( byref x as const XString )
Appends the value of an XString
declare operator += ( byref x as const XString )
Appends the value of an XString
declare operator &= ( byref x as const XString )
Removes all occurances of a substring
declare operator -= ( byref x as const XString )
Appends the value of the XString a number of times
declare operator *= ( byval n as ext.SizeType )
Returns ext.true if empty, ext.false otherwise
declare const function Empty ( ) as bool
Returns the length, in characters.
declare const function Len ( ) as ext.SizeType
Trims whitespace from both sides of the XString object
declare sub Trim ( )
Trims whitespace from the left side of a XString object
declare sub LTrim ( )
Trims whitespace from the right side of a XString object
declare sub RTrim ( )
Searchs a string for the first occurence of a substring
declare function Instr ( byval start as integer = 0, byref search as const string ) as integer
Transforms the alphabetical characters into uppercase
declare sub UCase ( )
Transforms the alphabetical characters into lowercase
declare sub LCase ( )
Returns a string of length characters from the left side of the XString object
declare function Left ( byval length as integer ) as string
Returns a string of length characters from the right side of the XString object
declare function Right ( byval length as integer ) as string
Performs an in-object text replace
declare sub Mid ( byref text as const string, byval start as integer, byval length as integer )
Replaces a substring with a string you provide
declare sub Replace ( byref oldtext as const string, byref newtext as const string )
Capitalizes the first letter in the XString object
declare sub UCFirst ( )
Makes the first letter in the XString object lower case
declare sub LCFirst ( )
Pads a XString object with another string, similiar to php’s str_pad
declare sub Pad ( byval length as integer, byref pad_str as const string = " ", byval opt as PAD_OPTION = STR_PAD_RIGHT )
Pads a XString object with another string, similiar to php’s str_pad
declare const function PadCopy ( byval length as integer, byref pad_str as const string = " ", byval opt as PAD_OPTION = STR_PAD_RIGHT ) as XString
Performs a rot13 rotation on a XString object
declare sub Rot13 ( )
Performs a rot13 rotation on a XString object
declare const function Rot13Copy ( ) as XString
Calculates the 32 bit Cyclic Redundancy Check of a XString object and replaces the string with the hexidecimal representation of the CRC
declare sub CRC32 ( )
Calculates the 32 bit Cyclic Redundancy Check of a XString object
declare const function CRC32Copy ( ) as XString
Performs a text substitution in the XString object
declare const function ReplaceCopy ( byref oldtext as const string, byref newtext as const string ) as XString
Splits the string into an array.
declare function Explode ( byref delimit as const string, res() as string ) as integer
Splits the string into an array.
declare function Split ( result() as string, byref delimiter as const string, byval limit as integer ) as integer
Randomly shuffles the characters in the string.
declare sub Shuffle ( )
Returns a portion of a string.
declare function Substr ( byval offset as integer = 0 ) as XString
Compares a portion of an XString with another.
declare const function SubstrCompare ( byref b as const string, byval offset as integer = 0 ) as integer
Finda the number of strings contained in the XString.
declare const function SubstrCount ( byref needle as const string, byval offset as integer = 0 ) as integer
Replaces a portion of the XString with another.
declare sub SubstrReplace ( byref replacement as const string, byval offset as integer = 0 )
Find the position of a string in the object
declare const function Pos ( byref needle as const string, byval offset as integer = 0 ) as integer
Repeats the string a certain number of times.
declare function Repeat ( byval n as integer ) as XString
Reverses the string in-place.
declare sub Reverse ( )
Reverses the string.
declare const function ReverseCopy ( ) as XString