Reference StrIsAttr
Declared in Codebot.System.pas on line 462
Returns true if a string matches to rules of an attribute
{ End of line characters used by various operating systems }
const
LineBreakStyles: array[TTextLineBreakStyle] of string = (#10, #13#10, #13);
{ The character used to begin command line switches }
SwitchChar = '-';
{ Returns the line break sequence for the current operating system }
function LineBreak: string; inline;
{ Convert a string to uppercase }
function StrUpper(const S: string): string;
{ Convert a string to lowercase }
function StrLower(const S: string): string;
{ Copies a substring given a start and length }
function StrCopy(const S: string; Start: Integer; Len: Integer = 0): string;
{ Copy a memory buffer into a string }
function StrCopyData(P: Pointer; Len: Integer): string;
{ Inserts a substring into a string at a position }
function StrInsert(const S, SubStr: string; Position: Integer): string;
{ Compares two strings optionally ignoring case returning -1 if A comes before
B, 1 if A comes after B, or 0 if A and B are equal }
function StrCompare(const A, B: string; IgnoreCase: Boolean = False): Integer;
{ Searches a string for a substring optionally ignoring case }
function StrFind(const S, SubStr: string; IgnoreCase: Boolean = False): Integer; overload;
{ Searches a string for a substring from a start position optionally ignoring
case }
function StrFind(const S, SubStr: string; Start: Integer; IgnoreCase: Boolean = False): Integer; overload;
{ Returns the number of a substring matches within a string }
function StrFindCount(const S, SubStr: string; IgnoreCase: Boolean = False): Integer;
{ Returns an array of indices of a substring matches within a string }
function StrFindIndex(const S, SubStr: string; IgnoreCase: Boolean = False): IntArray;
{ Replaces every instance of a pattern in a string }
function StrReplace(const S, OldPattern, NewPattern: string; IgnoreCase: Boolean = False): string;
{ Replaces the first instance of a pattern in a string }
function StrReplaceOne(const S, OldPattern, NewPattern: string; IgnoreCase: Boolean = False): string;
{ Replaces everything after the first instance of a pattern in a string }
function StrReplaceAfter(const S, OldPattern, NewPattern: string; IgnoreCase: Boolean = False): string;
{ Trims white space from both sides of a string }
function StrTrim(const S: string): string;
{ Returns true if a case insensitive string matches a value }
function StrEquals(const S: string; Value: string): Boolean; overload;
{ Returns true if a case insensitive string matches any in a set of values }
function StrEquals(const S: string; const Values: array of string): Boolean; overload;
{ Returns the index of a string in a string array or -1 if there is no match }
function StrIndex(const S: string; const Values: array of string): Integer;
{ Splits a string into a string array using a separator }
function StrSplit(const S, Separator: string): StringArray;
{ Splits a string into a int array using a separator }
function StrSplitInt(const S, Separator: string): IntArray;
{ Splits a string into a int64 array using a separator }
function StrSplitInt64(const S, Separator: string): Int64Array;
{ Returns an array of whitespace separated tokens }
function StrSplitTokens(const S: string): StringArray;
{ Join a string array into a string using a separator }
function StrJoin(const A: StringArray; const Separator: string): string;
{ Join an int array into a string using a separator }
function StrJoinInt(const A: IntArray; const Separator: string): string;
{ Returns the first subsection of a string if it were split using a separator }
function StrFirstOf(const S, Separator: string): string;
{ Returns the second subsection of a string if it were split using a separator }
function StrSecondOf(const S, Separator: string): string;
{ Returns the last subsection of a string if it were split using a separator }
function StrLastOf(const S, Separator: string): string;
{ Search a string for a substring optionally ignoring case }
function StrContains(const S, SubStr: string; IgnoreCase: Boolean = False): Boolean;
{ Returns true if a string begins with a substring while optionally ignoring
case }
function StrBeginsWith(const S, SubStr: string; IgnoreCase: Boolean = False): Boolean;
{ Returns true if a string end with a substring while optionally ignoring case }
function StrEndsWith(const S, SubStr: string; IgnoreCase: Boolean = False): Boolean;
{ Returns a string of a given length filled with one repeating character }
function StrOf(C: Char; Len: Integer): string;
{ Returns a string made to fit a given length padded on the left with a
character }
function StrPadLeft(const S: string; C: Char; Len: Integer): string;
{ Returns a string made to fit a given length padded on the right with a
character }
function StrPadRight(const S: string; C: Char; Len: Integer): string;
{ Returns a string surrounded by quotes if it contains whitespace }
function StrQuote(const S: string): string;
{ Returns true if a string contains only whitespace characters }
function StrIsBlank(const S: string): Boolean;
{ Returns true if a string matches to rules of an identifier }
function StrIsIdent(const S: string): Boolean;
{ Returns true if a string matches to rules of an attribute }
function StrIsAttr(const S: string): Boolean;
{ Returns the line break style for a block of text }
function StrLineBreakStyle(const S: string): TTextLineBreakStyle;
{ Converts the line break style of a block of text using the desired style }
function StrAdjustLineBreaks(const S: string; Style: TTextLineBreakStyle): string; overload;
{ Converts the line break style of a block of text using the system defined
style }
function StrAdjustLineBreaks(const S: string): string; overload;
{ Convert a string to a wide string }
function StrToWide(const S: string): WideString;
{ Convert a wide string to string }
function WideToStr(const S: WideString): string;
{ Returns true if a program has a matching switch }
function SwitchExists(const Switch: string): Boolean;
{ Returns the index of a program's matching switch or -1 if no match was found }
function SwitchIndex(const Switch: string): Integer;
{ Returns the value of a program's switch }
function SwitchValue(const Switch: string): string;
{ Convert an string to a binary format eg: ¢ = 11000010 10100010 }
function StrToBin(S: string): string;
{ Convert an integer to a string }
function IntToStr(Value: Integer): string;
{ Convert a string to an integer. Can throw an EConvertError exception. }
function StrToInt(const S: string): Integer;
{ Convert a string an integer. Returns a default value if conversion cannot be
done. }
function StrToIntDef(const S: string; Default: Integer): Integer;
{ Convert a float to a string }
function FloatToStr(Value: Extended): string; overload;
{ Convert a float to a string with a given number of decimals }
function FloatToStr(Value: Extended; Decimals: Integer): string; overload;
{ Convert a float to a comma string with a given number of decimals }
function FloatToCommas(Value: Extended; Decimals: Integer = 0): string;
{ Convert a string to a float. Can throw an EConvertError exception. }
function StrToFloat(const S: string): Extended;
{ Convert a string a float. Returns a default value if conversion cannot be
done. }
function StrToFloatDef(const S: string; Default: Extended): Extended;
{ Search for and return a named environment variable }
function StrEnvironmentVariable(const Name: string): string;
{ Formats a series of arguments into a string }
function StrFormat(const S: string; Args: array of const): string;
{ Retrieve the component hierarchy as a path of component names }
function StrCompPath(Component: TComponent): string;