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
pInitialValuestringThe 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
pCharToAddcharThe 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
pStringToAddstringThe 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
pCharacterCountintThe 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
pSepCharstringThe separation character, like ','
pRecognizeSQLbracketsboolIf True, also square brackets are taken into account.
pRecognizeSingleQuotesboolIf True, also single quotes are taken into account.
pSupportCurlyBracketsExpressionsboolIf True, recognizes curly brackets that are preceeded by a $ or @ character (like in Polar Script).
pSuppressExceptionsboolIf 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
pSepCharstringThe separation character, like ','
pErrorMessagestringThis by-ref parameter will be set to an error message if applicable.
pRecognizeSQLbracketsboolIf True, also square brackets are taken into account.
pRecognizeSingleQuotesboolIf True, also single quotes are taken into account.
pSupportCurlyBracketsExpressionsInStringsboolIf 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
pIgnoreSpacesboolIf True, all spaces at the beginning of the string are removed.
pOptimizeForVBscriptParsingboolIs used for not recognizing square brackets and single quotes.
pTreatPlusAndMinusAsOperatorsboolIf 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
pSepCharstringThe separation character(s) to search for.
pCompareBinaryboolPass 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
pFindStringstringThe text to search for.
pReplaceStringstringThe text to replace the found text for.
pStartintThe 1-based start character to start searching.
pCountintThe number of occurrences to replace.
pTextCompareboolPass 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
pStartintThe 1-based start where to place the pNewString.
pLengthintThe number of characters to remove.
pNewValuestringThe value to insert at the pStart.
Returns
ToString()
Returns the value of the string.
public override string ToString()