Table of Contents

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 string

The value to put in the string.

Properties

Length

Returns the length of the string in characters.

public int Length { get; }

Property Value

int

Value

Returns the value of the string.

public string Value { get; set; }

Property Value

string

Methods

Add(char)

Adds a char to the end of the string (append).

public clsString Add(char pCharToAdd)

Parameters

pCharToAdd char

The 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 string

The 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 int

The 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 string

The separation character, like ','

pRecognizeSQLbrackets bool

If True, also square brackets are taken into account.

pRecognizeSingleQuotes bool

If True, also single quotes are taken into account.

pSupportCurlyBracketsExpressions bool

If True, recognizes curly brackets that are preceeded by a $ or @ character (like in Polar Script).

pSuppressExceptions bool

If 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 string

The separation character, like ','

pErrorMessage string

This by-ref parameter will be set to an error message if applicable.

pRecognizeSQLbrackets bool

If True, also square brackets are taken into account.

pRecognizeSingleQuotes bool

If True, also single quotes are taken into account.

pSupportCurlyBracketsExpressionsInStrings bool

If 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 bool

If True, all spaces at the beginning of the string are removed.

pOptimizeForVBscriptParsing bool

Is used for not recognizing square brackets and single quotes.

pTreatPlusAndMinusAsOperators bool

If 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 string

The separation character(s) to search for.

pCompareBinary bool

Pass 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

pStringToInsert string

The string to insert.

pPostion int

The position to insert the string.

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

pStart int

The 1-based charater to start at.

pLength int

The length of the string to get.

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 string

The text to search for.

pReplaceString string

The text to replace the found text for.

pStart int

The 1-based start character to start searching.

pCount int

The number of occurrences to replace.

pTextCompare bool

Pass 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 int

The 1-based start where to place the pNewString.

pLength int

The number of characters to remove.

pNewValue string

The value to insert at the pStart.

Returns

clsString

ToString()

Returns the value of the string.

public override string ToString()

Returns

string