strings/ substr.bi

Summary
strings/ substr.bi
LicenseCopyright © 2009, FreeBASIC Extended Library Development Group
ext. strings
Functions
SubStrReturns a portion of a string.
SubStrReturns a portion of a string.
SubStrCompareCompares a substring with another.
SubStrCompareCompares a substring with another.
SubStrCountFinds the number of substrings within a string.
SubStrCountFinds the number of substrings within a portion of a string.
SubStrReplaceReplaces a substring with another.
SubStrReplaceReplaces a substring with another.

License

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

ext. strings

Summary
Functions
SubStrReturns a portion of a string.
SubStrReturns a portion of a string.
SubStrCompareCompares a substring with another.
SubStrCompareCompares a substring with another.
SubStrCountFinds the number of substrings within a string.
SubStrCountFinds the number of substrings within a portion of a string.
SubStrReplaceReplaces a substring with another.
SubStrReplaceReplaces a substring with another.

Functions

SubStr

declare function SubStr overload (byref subject as const string,  
byval offset as integer =  0) as string

Returns a portion of a string.

Parameters

subjectthe string to return a portion of.
offsetzero-based offset of substring. if negative, specifies (-offset) chars from the end of the string

Returns

The portion of the string following the offset passed.

SubStr

declare function SubStr (byref subject as const string,
byval offset as integer,
byval length as integer) as string

Returns a portion of a string.

Parameters

subjectthe string to return a portion of.
offsetzero-based offset of substring. if negative, specifies (-offset) chars from the end of the string
lengththe number of characters from offset to include. if negative, specifies all but the remaining (-length) characters.

Returns

The requested sub string.

SubStrCompare

declare function SubStrCompare overload (
   byref a as const string,  
   byref b as const string,  
   byval offset as integer =  0
) as integer

Compares a substring with another.

Parameters

aA string.
bA string.
offsetzero-based offset of substring. if negative, specifies (-offset) chars from the end of the string

Returns

Returns a negative, zero or positive value if a is less than, equal to or greater than b, respectively.

SubStrCompare

declare function SubStrCompare (byref a as const string,
byref b as const string,
byval offset as integer,
byval length as integer) as integer

Compares a substring with another.

Parameters

aA string.
bA string.
offsetzero-based offset of substring. if negative, specifies (-offset) chars from the end of the string
lengththe number of characters from offset to include. if negative, specifies all but the remaining (-length) characters.

Returns

Returns a negative, zero or positive value if a is less than, equal to or greater than b, respectively.

SubStrCount

declare function SubStrCount overload (
   byref haystack as const string,  
   byref needle as const string,  
   byval offset as integer =  0
) as integer

Finds the number of substrings within a string.

Parameters

haystackThe string to search.
needleThe substring to search for.
offsetThe zero-based offset into the haystack to start the search.  If negative, specifies -offset chars from the end of the haystack.

Returns

The number of times the needle was found in the haystack.

SubStrCount

declare function SubStrCount (byref haystack as const string,
byref needle as const string,
byval offset as integer,
byval length as integer) as integer

Finds the number of substrings within a portion of a string.

Parameters

haystackThe string to search.
needleThe substring to search for.
offsetThe zero-based offset into the haystack to start the search.  If negative, specifies -offset chars from the end of the haystack.
lengthThe size of the portion of haystack to search.  If negative, specifies all but the remaining -length characters.

Returns

The number of times the needle was found in the haystack.

SubStrReplace

declare sub SubStrReplace overload (byref subject as string,  
byref replacement as const string,  
byval offset as integer =  0)

Replaces a substring with another.

Parameters

subjectThe string containing the substring to replace.
replacementThe new substring.
offsetThe zero-based offset of the substring.  If negative, specifies -offset chars from the end of the subject string

SubStrReplace

declare sub SubStrReplace (byref subject as string,
byref replacement as const string,
byval offset as integer,
byval length as integer)

Replaces a substring with another.

Parameters

subjectThe string containing the substring to replace.
replacementThe new substring.
offsetThe zero-based offset of the substring.  If negative, specifies -offset chars from the end of the subject string
lengthThe number of characters from offset to replace.  If negative, specifies all but the remaining -length characters.
declare function SubStr overload (byref subject as const string,  
byval offset as integer =  0) as string
Returns a portion of a string.
declare function SubStrCompare overload (
   byref a as const string,  
   byref b as const string,  
   byval offset as integer =  0
) as integer
Compares a substring with another.
declare function SubStrCount overload (
   byref haystack as const string,  
   byref needle as const string,  
   byval offset as integer =  0
) as integer
Finds the number of substrings within a string.
declare sub SubStrReplace overload (byref subject as string,  
byref replacement as const string,  
byval offset as integer =  0)
Replaces a substring with another.