Class clsString
- Namespace
- PolarStudioGlobals
- Assembly
- PolarStudioGlobals.dll
The Polar Studio String object. Used to build or consume (large) strings.
public class clsString : IDisposable
- Inheritance
-
clsString
- Implements
- Inherited Members
- Extension Methods
Constructors
clsString()
Constructor.
public clsString()
clsString(string)
Creates a new string with the specified initial value.
public clsString(string pInitialValue)
Parameters
pInitialValue
stringThe value to put in the string.
Properties
Length
Returns the length of the string in characters.
public int Length { get; }
Property Value
Value
Returns the value of the string.
public string Value { get; set; }
Property Value
Methods
Add(char)
Adds a char to the end of the string (append).
public clsString Add(char pCharToAdd)
Parameters
pCharToAdd
charThe char to append.
Returns
- clsString
This clsString object.
Add(string)
Adds a string to the end of the string (append)
public clsString Add(string pStringToAdd)
Parameters
pStringToAdd
stringThe string to add.
Returns
- clsString
This clsString object.
Clear()
Clears the contents of the string.
public clsString Clear()
Returns
- clsString
This clsString object.
Dispose()
public void Dispose()
~clsString()
protected ~clsString()
GetCharacters(int)
Returns the specified number of characters and removes these from the beginning of the string.
public string GetCharacters(int pCharacterCount = 1)
Parameters
pCharacterCount
intThe number of characters to get.
Returns
- string
A string containing the characters.
GetCommand(string, bool, bool, bool, bool)
Gets a command from the string. Is sensitive for quotes and brackets.
public string GetCommand(string pSepChar, bool pRecognizeSQLbrackets = false, bool pRecognizeSingleQuotes = false, bool pSupportCurlyBracketsExpressions = false, bool pSuppressExceptions = false)
Parameters
pSepChar
stringThe separation character, like ','
pRecognizeSQLbrackets
boolIf True, also square brackets are taken into account.
pRecognizeSingleQuotes
boolIf True, also single quotes are taken into account.
pSupportCurlyBracketsExpressions
boolIf True, recognizes curly brackets that are preceeded by a $ or @ character (like in Polar Script).
pSuppressExceptions
boolIf True, exceptions (like mismatch of brackets) are suppressed.
Returns
- string
The found part of the string (the string object now contains the rest of the string).
Exceptions
- Exception
May return exceptions if quotes or brackets not matching.
GetCommand(string, ref string, bool, bool, bool)
Gets a command from the string. Is sensitive for quotes and brackets.
public string GetCommand(string pSepChar, ref string pErrorMessage, bool pRecognizeSQLbrackets = false, bool pRecognizeSingleQuotes = false, bool pSupportCurlyBracketsExpressionsInStrings = false)
Parameters
pSepChar
stringThe separation character, like ','
pErrorMessage
stringThis by-ref parameter will be set to an error message if applicable.
pRecognizeSQLbrackets
boolIf True, also square brackets are taken into account.
pRecognizeSingleQuotes
boolIf True, also single quotes are taken into account.
pSupportCurlyBracketsExpressionsInStrings
boolIf True, recognizes curly brackets that are preceeded by a $ or @ character (like in Polar Script).
Returns
- string
The found part of the string (the string object now contains the rest of the string).
Exceptions
- Exception
May return exceptions if quotes or brackets not matching.
GetKeyword(bool, bool, bool)
Gets the next 'Keyword'. Used to parse strings like queries.
public string GetKeyword(bool pIgnoreSpaces = true, bool pOptimizeForVBscriptParsing = false, bool pTreatPlusAndMinusAsOperators = false)
Parameters
pIgnoreSpaces
boolIf True, all spaces at the beginning of the string are removed.
pOptimizeForVBscriptParsing
boolIs used for not recognizing square brackets and single quotes.
pTreatPlusAndMinusAsOperators
boolIf this parameter is set to true and the string starts with a plus or minus character, this single character is returns as being an operator.
Returns
- string
A logical part at the beginning of the string making up a keyword.
GetStringPart(string, bool)
Searches the value of the string from the beginning for the specified separation character(s) and returns the text found before. The separation character(s) are removed and the value of the string is set to the text AFTER the found separation. If the separation character is not found, the whole string is returned and the value of this clsString object is empty afterwards.
public string GetStringPart(string pSepChar = ";", bool pCompareBinary = false)
Parameters
pSepChar
stringThe separation character(s) to search for.
pCompareBinary
boolPass as true to search case-sensitive (faster).
Returns
- string
The characters found befor the separation character.
Insert(string, int)
Inserts a string into the contents of the string at the specified location. Defaults to 0 (the start of the string).
public clsString Insert(string pStringToInsert, int pPostion = 0)
Parameters
Returns
- clsString
This clsString object.
Mid(int, int)
Returns a sub-string at the 1-based start with the specified pLength.
public string Mid(int pStart, int pLength)
Parameters
Returns
- string
The sub-string.
Replace(string, string, int, int, bool)
Searches the string for a specified FindString and replaces the instances with the specified ReplaceString.
public clsString Replace(string pFindString, string pReplaceString, int pStart = 1, int pCount = -1, bool pTextCompare = false)
Parameters
pFindString
stringThe text to search for.
pReplaceString
stringThe text to replace the found text for.
pStart
intThe 1-based start character to start searching.
pCount
intThe number of occurrences to replace.
pTextCompare
boolPass as true to use text-compare (case insensitive).
Returns
- clsString
This clsString object.
SetMid(int, int, string)
Replaces the specified sub string by the new value. If the specified pLength is not equal of the new pNewValue, then the length of the string will change.
public clsString SetMid(int pStart, int pLength, string pNewValue)
Parameters
pStart
intThe 1-based start where to place the pNewString.
pLength
intThe number of characters to remove.
pNewValue
stringThe value to insert at the pStart.
Returns
ToString()
Returns the value of the string.
public override string ToString()