Sign in Join
FPDoc Onlineexperiment

StrUtils unit

Various string handling routines.

Procedures and functions

AddCharfunctionAdd characters to the left of a string till a certain length.
AddCharRfunctionAdd chars at the end of a string till it reaches a certain length.
AnsiContainsStrfunctionChecks whether a string contains a given substring.
AnsiContainsTextfunctionCheck whether a string contains a certain substring, ignoring case.
AnsiEndsStrfunctionCheck whether a string ends with a certain substring.
AnsiEndsTextfunctionCheck whether a string ends with a certain substring, ignoring case.
AnsiIndexStrfunctionSearches, observing case, for a string in an array of strings.
AnsiIndexTextfunctionSearches, case insensitive, for a string in an array of strings.
AnsiLeftStrfunctionCopies a number of characters starting at the left of a string.
AnsiMatchStrfunctionCheck whether a string occurs in an array of strings, observing case.
AnsiMatchTextfunctionCheck whether a string occurs in an array of strings, disregarding case.
AnsiMidStrfunctionReturns a number of characters copied from a given location in a string.
AnsiProperCasefunctionPretty-Print a string: make lowercase and capitalize first letters of words.
AnsiReplaceStrfunctionSearch and replace all occurrences of a string, case sensitive.
AnsiReplaceTextfunctionSearch and replace all occurrences of a string, case insensitive.
AnsiResemblesTextfunctionCheck whether 2 strings resemble each other.
AnsiReverseStringfunctionReverse the letters in a string.
AnsiRightStrfunctionCopies a number of characters starting at the right of a string.
AnsiStartsStrfunctionCheck whether a string starts with a given substring, observing case.
AnsiStartsTextfunctionCheck whether a string starts with a given substring, ignoring case.
BinToHexprocedureConvert a binary buffer to a hexadecimal string.
ContainsStrfunctionCheck whether one text contains another (case sensitive).
ContainsTextfunctionCheck whether one text contains another (case insensitive).
Copy2SpacefunctionReturns all characters in a string till the first space character (not included).
Copy2SpaceDelfunctionDeletes and returns all characters in a string till the first space character (not included).
Copy2SymbfunctionReturns all characters in a string till a given character (not included).
Copy2SymbDelfunctionDeletes and returns all characters in a string till a given character (not included).
Dec2NumbfunctionConvert a decimal number to a string representation, using given a base.
DecodeSoundexIntfunctionDecodes the integer representation of a soundex code and returns the original soundex code.
DecodeSoundexWordfunctionDecodes the word-sized representation of a soundex code and returns the original soundex code.
DelCharsfunctionDelete all occurrences of a given character from a string.
DelSpacefunctionDelete all occurrences of a space from a string.
DelSpace1functionReduces sequences of space characters to 1 space character.
DupeStringfunctionCreates and concatenates N copies of a string.
EndsStrfunctionCheck whether one string ends with another.
EndsTextfunctionCheck whether one text ends with another.
ExtractDelimitedfunctionExtract the N-th delimited part from a string.
ExtractSubstrfunctionExtract a word from a string, starting at a given position in the string.
ExtractWordfunctionExtract the N-th word out of a string.
ExtractWordPosfunctionExtract a word from a string, and return the position where it was located in the string.
FindMatchesBoyerMooreCaseInSensitivefunctionFind case-insensitive matches of a string using a Boyer-Moore algorithm.
FindMatchesBoyerMooreCaseSensitivefunctionFind case-sensitive matches of a string using a Boyer-Moore algorithm.
FindPartfunctionSearch for a substring in a string, using wildcards.
GetCmdLineArgfunctionReturns the command-line argument following the given switch.
Hex2DecfunctionConverts a hexadecimal string to a decimal value.
Hex2Dec64functionConvert hexadecimal value to 64-bit integer.
HexToBinfunctionConvert a hexadecimal string to a binary buffer.
IfThenfunctionReturns one of two strings, depending on a boolean expression.
in(Ansistring,):Booleanoperator
in(UnicodeString,):BooleanoperatorCheck presence of string in an array of strings.
IndexStrfunctionSearches, observing case, for a string in an array of strings.
IndexTextfunctionIndex of text in a list of values.
IntToBinfunctionConverts an integer to a binary string representation, inserting spaces at fixed locations.
IntToRomanfunctionRepresent an integer with roman numerals.
IsEmptyStrfunctionCheck whether a string is empty, disregarding whitespace characters.
IsWildfunctionCheck whether a string matches a wildcard search expression.
IsWordPresentfunctionCheck for the presence of a word in a string.
LeftBStrfunctionCopies Count characters starting at the left of a string.
LeftStrfunctionCopies Count characters starting at the left of a string.
MatchStrfunctionCheck whether a string occurs in an array of strings, observing case.
MatchTextfunctionCheck if a string is in a list of values.
MidBStrfunctionCopies a number of characters starting at a given position in a string.
MidStrfunctionCopies a number of characters starting at a given position in a string.
NaturalCompareTextfunctionCompare using natural sort.
NPosfunctionReturns the position of the N-th occurrence of a substring in a string.
Numb2DecfunctionConverts a string representation of a number to its numerical value, given a certain base.
Numb2USAfunctionInsert thousand separators.
PadCenterfunctionPad the string to a certain length, so the string is centered.
PadLeftfunctionAdd spaces to the left of a string till a certain length is reached.
PadRightfunctionAdd spaces to the right of a string till a certain length is reached.
PosExfunctionSearch for the occurrence of a character in a string, starting at a certain position.
PosSetfunctionReturn the position in a string of any character out of a set of characters.
PosSetExfunctionReturn the position in a string of any character out of a set of characters, starting at a certain position.
RandomFromfunctionChoose a random string from an array of strings.
RemoveLeadingCharsprocedureRemove any leading characters in a set from a string.
RemovePadCharsprocedureRemove any trailing or leading characters in a set from a string.
RemoveTrailingCharsprocedureRemove any trailing characters in a set from a string.
ReplaceStrfunctionReplace strings case-sensitively.
ReplaceTextfunctionReplace strings case-insensitively.
ResemblesTextfunctionCheck whether 2 strings resemble each other.
ReverseStringfunctionReverse characters in a string.
RightBStrfunctionCopy a given number of characters (bytes), counting from the right of a string.
RightStrfunctionCopy a given number of characters, counting from the right of a string.
RomanToIntfunctionConvert a string with a Roman number to it's decimal value.
RomanToIntDeffunctionConvert a roman numeral to an integer value.
RPosfunctionFind last occurrence of substring or character in a string.
RPosExfunctionFind last occurrence substring or character in a string, starting at a certain position.
SearchBuffunctionSearch a buffer for a certain string.
SecureComparefunction
SoundexfunctionCompute the soundex of a string.
SoundexComparefunctionCompare soundex values of 2 strings.
SoundexIntfunctionSoundex value as an integer.
SoundexProcfunctionDefault AnsiResemblesText implementation.
SoundexSimilarfunctionCheck whether 2 strings have equal soundex values.
SoundexWordfunctionCalculate a word-sized soundex value.
SplitCommandLinefunctionSplit commandline in a series of separate arguments.
SplitStringfunctionSplit a string in words.
StartsStrfunctionCheck whether one string starts with another.
StartsTextfunctionCheck whether one text starts with another.
StringReplacefunctionOptimized search-and-replace algorithm.
StringsReplacefunctionReplace occurrences of a set of strings to another set of strings.
StuffStringfunctionReplace part of a string with another string.
Tab2SpacefunctionConvert tab characters to a number of spaces.
TrimLeftSetfunctionRemove any leading characters in a set from a string and returns the result.
TrimRightSetfunctionRemove any trailing characters in a set from a string and returns the result.
TrimSetfunctionRemove any leading or trailing characters in a set from a string and returns the result.
TryRomanToIntfunctionTry to convert a roman numeral to an integer value.
WordCountfunctionCount the number of words in a string.
WordPositionfunctionSearch position of Nth word in a string.
XorDecodefunctionDecode a string encoded with .
XorEncodefunctionEncode a string by XOR-ing its characters using characters of a given key, representing the result as hex values.
XorStringfunctionEncode a string by XOR-ing its characters using characters of a given key.

Types

SizeIntArraytypeArray of SizeInt.
TCompareTextProcprocedure typeFunction prototype for comparing two string in .
TRawByteStringArraytypeArray of RawByteString.
TRomanConversionStrictnessenumerationHow to treat invalid roman numerals in TryRomanToInt.
TSoundexIntLengthtypeRange of allowed integer soundex lengths.
TSoundexLengthtypeRange of allowed soundex lengths.
TStringReplaceAlgorithmenumerationAlgorithm to use in StringReplace.
TStringSeachOptiontypePossible options for call.
TStringSearchOptionenumerationPossible options for call.
TStringSearchOptionssetSet of options for call.
TUnicodeStringArraytype

Constants

AnsiResemblesProcconstantProcedural variable, called when checking 2 strings for resemblances in .
BracketsconstantSet of characters that contain all possible bracket characters.
DigitCharsconstantSet of digit characters.
ResemblesProcconstantCallback to compute string soundex.
StdSwitchCharsconstantStandard characters for the SwitchChars argument of .
StdWordDelimsconstantStandard word delimiter values.
WordDelimitersconstantStandard word delimiters.

Resource strings

SErrAmountStringsresource stringError message used in stringsreplace function.
SInvalidRomanNumeralresource stringError string shown in exception raised when invalid roman numeral is encountered.

Uses

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.