IGLib  1.7.2
The IGLib base library for development of numerical, technical and business applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
IG.Lib.UtilStr Class Reference

Various string operations, random strings, random characters, etc. More...

+ Inheritance diagram for IG.Lib.UtilStr:
+ Collaboration diagram for IG.Lib.UtilStr:

Static Public Member Functions

static bool ArraysEqual< ElementType > (ElementType[] originals, ElementType[] compared)
 Returns true if the specified arrays are equal (i.e. all corresponding values are equal or both arrays are null), false if not. More...
 
static bool StringArraysEqual (string[] originals, string[] compared)
 Returns true if the specified string arrays are equal (i.e. all corresponding values are equal or both arrays are null), false if not. More...
 
static string[] GetParametersArrayPlain (string listString)
 Returns a string array of parameters represented by the specified comma separated list in string form. More...
 
static string GetParametersStringPlain (string[] parameters)
 Returns a string representation of the list of parameters, separated by commas but not embedded in any braces. More...
 
static string[] GetLines (string linesString, bool doTrim=true)
 Returns a string array of parameters represented by the specified comma separated list in string form. More...
 
static string GetLinesStringPlain (string[] lines)
 Returns a string representation of the list of lines, separated by newlines. More...
 
static string GetCommandLine (string CommandName, string[] CommandArguments)
 Assembles and returns the commandline string that corresponds to the specified command name and arguments. More...
 
static string GetCommandLine (string[] commandNameAndArguments)
 Assembles and returns the commandline string that corresponds to the specified command name and arguments. More...
 
static string[] GetArgumentsArray (string commandLine)
 Parses a command line and extracts arguments from it. Arguments can be separated according to usual rules for command-line arguments: spaces are separators, there can be arbitraty number of spaces, and if we want an argument to contain spaces, we must enclose it in double quotes. Command line can also contain the command name followed by arguments. In this case it is treated in the same way, and command can be obtained simply as the first string in the returned array. More...
 
static void GetArguments (string commandLine, ref List< string > ret)
 Parses a command line and extracts arguments from it. Arguments can be separated according to usual rules for command-line arguments: spaces are separators, there can be arbitraty number of spaces, and if we want an argument to contain spaces, we must enclose it in double quotes. Command line can also contain the command name followed by arguments. In this case it is treated in the same way, and command can be obtained simply as the first string in the returned array. More...
 
static string RandomUnicodeString (int stringLength, IRandomGenerator rndgen=null)
 Creates and returns a valid random unicode string. All possible uncode characters may be contained in the generated string, EXCEPT the surogate characters in the range 0xD800-0xDFFF. More...
 
static string RandomUnicodeString (int stringLength, bool excludeSurrogates=true, IRandomGenerator rndgen=null)
 Creates and returns a valid random unicode string. All legal uncode characters may be contained in the generated string. More...
 
static char RandomCharCapitalLetter (IRandomGenerator rndgen=null)
 Returns a random character that is a capital letter (A-Z) More...
 
static char RandomCharSmallLetter (IRandomGenerator rndgen=null)
 Returns a random character that is a small letter (a-z) More...
 
static char RandomCharNumeric (IRandomGenerator rndgen=null)
 Returns a random numeric character (0-9) More...
 
static char RandomChar (CharType typeflags, IRandomGenerator rndgen=null)
 Returns a random character whose type is specified by type flags. Type flags can be combined by bitwise operations. More...
 
static char RandomChar (IRandomGenerator rndgen=null)
 Returns a random character that is either a capital letter (A-Y) or a small letter (a-z). Type flags can be combined by bitwise operations. More...
 
static string RandomString (int length, CharType flags, bool firstletter, IRandomGenerator rndgen=null)
 Returns a randomly generated string of a specified length whose characters are of specified type(result). It can also be specified that the first character is a letter. More...
 
static string RandomString (int length, CharType flags, IRandomGenerator rndgen=null)
 Returns a randomly generated string of a specified length whose characters are of specified type(result). More...
 
static string RandomString (int length, bool firstletter, IRandomGenerator rndgen=null)
 Returns a randomly generated string composed of alphanumeric characters. It can be specified that the first character is a letter. More...
 
static string RandomString (int length, IRandomGenerator rndgen=null)
 Returns a randomly generated string of a specified length containing alphanumeric characters. The first character is a letter. More...
 
static string RandomString (IRandomGenerator rndgen=null)
 Returns a randomly generated string of a random length containing alphanumeric characters. The first character is a letter. Length is between 1 and the value specified by the MaxStringLength property. More...
 
static string RandomString (int stringLength, string allowedChars=null, IRandomGenerator rndgen=null)
 Creates and returns a random string consisting of only the letters contained in the specified string. More...
 
static bool IsAscii (char ch)
 Returns true if the specified character is an ASCII characters, and false otherwise. More...
 
static bool IsAsciiLetter (char ch)
 Returns true if the specified character is an ASCII letter, and false otherwise. More...
 
static bool IsAsciiDigit (char ch)
 Returns true if the specified character is an ASCII digit, and false otherwise. More...
 
static bool IsAsciiLetterOrDigit (char ch)
 Returns true if the specified character is either an ASCII letter or an ASCII digit, and false otherwise. More...
 
static bool IsVarName (char[] str)
 Returns true if the string corresponding to the specified array of characters is a legal standard representation of a variable name, and false otherwise. More...
 
static bool IsVariableName (string str)
 Returns true if the specified string is a legal standard representation of a variable name, and false otherwise. More...
 
static bool IsAsciiString (char[] str)
 Returns true if the string corresponding to the specified array of characters is an ASCII string (i.e. it contains only ASCII characters - from 0 to 255), and false otherwise. More...
 
static bool IsAsciiString (string str)
 Returns true if the string specified string is an ASCII string (i.e. it contains only ASCII characters - from 0 to 255), and false otherwise. More...
 
static bool ToBoolean (string strsetting)
 Converts a string representation of a boolean setting to boolean. More...
 
static bool IsBoolean (string str)
 Returns a boolean value indicating whether the specified string can represent a boolean value. More...
 
static long ToInt (string strsetting)
 Converts a string representation of an integer setting to an integer value. If the setting is not defined then 0 is returned. More...
 
static long ToInt (string strsetting, long defaultvalue)
 Converts a string representation of an integer setting to an integer value. More...
 
static bool IsInt (string str)
 Returns a boolean value indicating whether the specified string is a valid representation of an integer number. More...
 
static double ToDouble (string strsetting)
 Converts a string representation of a double setting to an integer value. If the setting is not defined then 0 is returned. More...
 
static double ToDouble (string strsetting, long defaultvalue)
 Converts a string representation of a double value to a number of type double. More...
 
static bool IsDouble (string str)
 Returns a boolean value indicating whether the specified string is a valid representation of a number (of type double). More...
 
static string Load (string filePath)
 Loads complete file contents into a stiring and returnes that string. More...
 
static void Load (string filePath, ref string readString)
 Loads complete file contents into the specified stiring. More...
 
static void Save (string str, string filePath, bool append)
 Saves the specified string to a specified file. If the specified file does not exists then it is created anew if possible. A boolean argument specifis whether to overwrite existing files or to append the string at the end of the file. More...
 
static void Save (string str, string filePath)
 Saves the specified string to a specified file. If the file already exists then is content is overwritten. If the file does not yet exist then it is created anew. More...
 
static void Append (string str, string filePath)
 Saves the specified string to a specified file. If the file already exists then string is appended at the end of the current file contents. If the file does not yet exist then it is created anew. More...
 
- Static Public Member Functions inherited from IG.Lib.UtilCsv
static bool CsvIsEmptyRow (string[][] values, int rowIndex)
 Returns true if the specified line in a 2D jagged array of string cell values (arranged in rows) is empty or does not exist, otherwise false is returned. More...
 
static string CsvGetValue (string[][] values, int rowIndex, int columnIndex)
 Returns the value of the specified cell of a 2D jagged array of string cell values (arranged in rows) at the specified row and column, or null if such a value does not exist. More...
 
static int CsvColumnIndex (string[][] values, string fieldName)
 Returns index of thr column that contains data with the specified name in a 2D jagged array of values. It is assumed that the first non-empty row (subarray) contains names of data columns. -1 is returned if the column with the specified field name is not found. Column (or field) names are assumed to be case insensitive. More...
 
static int CsvColumnIndex (string[][] values, string fieldName, bool caseSensitive)
 Returns index of thr column that contains data with the specified name in a 2D jagged array of values. It is assumed that the first non-empty row (subarray) contains names of data columns. -1 is returned if the column with the specified field name is not found. More...
 
static string[][] FromCsvString (string csvString)
 Converts a CSV string to a 2D jagged array of string values and returns it. Constant UtilCsv.DefaultCsvSeparator) is assumed to be a separator in the CSV format. More...
 
static string[][] FromCsvString (string csvString, string separator)
 Converts a CSV string to a 2D jagged array of string values and returns it. More...
 
static string ToCsvString (string[][] values, string separator)
 Convertsa a 2D jagged array of string values to a string in CSV format. More...
 
static string[][] LoadCsv (string filePath, string separator)
 Reads contents of a CSV file and returns a 2D jagged array of strigg values contained in the file. More...
 
static string[][] LoadCsv (string filePath)
 Reads contents of a CSV file and returns a 2D jagged array of strigg values contained in the file. Constant UtilCsv.DefaultCsvSeparator is assumed as separator in the CSV file. More...
 
static void SaveCsv (string filePath, string[][] values, string separator, bool append)
 Saves a 2D jagged array of string cell values into a CSV file. More...
 
static void SaveCsv (string filePath, string[][] values, string separator)
 Saves a 2D jagged array of string cell values into a CSV file. If the file already exists then its contents are overwritten. More...
 
static void SaveCsv (string filePath, string[][] values, bool append)
 Saves a 2D jagged array of string cell values into a CSV file. Constant UtilCsv.DefaultCsvSeparator is assumed to be a separator for the CSV format. More...
 
static void SaveCsv (string filePath, string[][] values)
 Saves a 2D jagged array of string cell values into a CSV file. If the file already exists then its contents are overwritten. Constant UtilCsv.DefaultCsvSeparator is assumed to be a separator for the CSV format. More...
 
static bool TestCsvStringConversion (string[][] values, string separator, bool printResults)
 Tests conversion of a 2D jagged array of string values to a CSV formatted string and back. Returns true if the array restored by conversion of the original array to a CSV string and back from a CSV string to a jagged array is the same (within inevitable ambiguities of the CSV format) as the original array. More...
 
static void ExampleCsv ()
 Example of using CSV format utilities. More...
 

Properties

static int MaxStringLength [get, set]
 Get or sets maximal length for generated strings (must be GREATER THAN 0). More...
 
- Properties inherited from IG.Lib.UtilCsv
static string CsvSeparator [get, set]
 

Static Private Member Functions

static void GetArguments (string commandLine, ref List< string > ret, ref List< string > aux)
 Parses a command line and extracts arguments from it. Arguments can be separated according to usual rules for command-line arguments: spaces are separators, there can be arbitraty number of spaces, and if we want an argument to contain spaces, we must enclose it in double quotes. Command line can also contain the command name followed by arguments. In this case it is treated in the same way, and command can be obtained simply as the first string in the returned array. More...
 

Static Private Attributes

static int _maxStringLength = 100
 

Additional Inherited Members

- Public Attributes inherited from IG.Lib.UtilCsv
const string DefaultCsvSeparator = ","
 The default separator in the CSV files - comma (","). More...
 
- Static Public Attributes inherited from IG.Lib.UtilCsv
static string _csvSeparator = DefaultCsvSeparator
 
- Static Protected Member Functions inherited from IG.Lib.UtilCsv
static string TableToString (string[][] values, string valueSeparator)
 Returns a string that represents a table of string values. Each value is embedded in double quotes, values are separated by commas, and tables of values are separated by newlines. More...
 

Detailed Description

Various string operations, random strings, random characters, etc.

$A Igor xx;

Member Function Documentation

static bool IG.Lib.UtilStr.ArraysEqual< ElementType > ( ElementType[]  originals,
ElementType[]  compared 
)
inlinestatic

Returns true if the specified arrays are equal (i.e. all corresponding values are equal or both arrays are null), false if not.

Parameters
originalsFirst array of strings to be compared.
comparedSecond array of strings to be compared.
Type Constraints
ElementType :IComparable<ElementType> 

References IG.Lib.Default.

static bool IG.Lib.UtilStr.StringArraysEqual ( string[]  originals,
string[]  compared 
)
inlinestatic

Returns true if the specified string arrays are equal (i.e. all corresponding values are equal or both arrays are null), false if not.

Parameters
originalsFirst array of strings to be compared.
comparedSecond array of strings to be compared.
static string [] IG.Lib.UtilStr.GetParametersArrayPlain ( string  listString)
inlinestatic

Returns a string array of parameters represented by the specified comma separated list in string form.

Parameters
listStringList of parameters in string form, comma separated and with possible whitespaces between them.
Returns
static string IG.Lib.UtilStr.GetParametersStringPlain ( string[]  parameters)
inlinestatic

Returns a string representation of the list of parameters, separated by commas but not embedded in any braces.

Parameters
parametersArray of parameters from which a comma separated list string is formed.

Referenced by IG.Forms.ScalarFunctionScriptControl.CreateFunctonSummary(), IG.Forms.VectorFunctionScriptControl.CreateFunctonSummary(), IG.Forms.ScalarFunctionScriptControl.GetFunctionSignature(), IG.Forms.VectorFunctionScriptControl.GetFunctionSignature(), and IG.Lib.ScalarFunctionLoader.GetParametersPlainListString().

static string [] IG.Lib.UtilStr.GetLines ( string  linesString,
bool  doTrim = true 
)
inlinestatic

Returns a string array of parameters represented by the specified comma separated list in string form.

Parameters
linesStringList of parameters in string form, comma separated and with possible whitespaces between them.
doTrimSpecifies whether parameter names should be trimmed.
static string IG.Lib.UtilStr.GetLinesStringPlain ( string[]  lines)
inlinestatic

Returns a string representation of the list of lines, separated by newlines.

Parameters
linesArray of parameters from which a comma separated list string is formed.
static string IG.Lib.UtilStr.GetCommandLine ( string  CommandName,
string[]  CommandArguments 
)
inlinestatic

Assembles and returns the commandline string that corresponds to the specified command name and arguments.

Parameters
CommandNameCommand name.
CommandArgumentsArray of command arguments.

Referenced by IG.Lib.CommandLineApplicationInterpreter.CmdPipeClientGetServerResponse(), and IG.Lib.CommandLineJobContainer.CommandLine().

static string IG.Lib.UtilStr.GetCommandLine ( string[]  commandNameAndArguments)
inlinestatic

Assembles and returns the commandline string that corresponds to the specified command name and arguments.

Parameters
commandNameAndArgumentsArray containing command names (0-th element) and its arguments.
static string [] IG.Lib.UtilStr.GetArgumentsArray ( string  commandLine)
inlinestatic

Parses a command line and extracts arguments from it. Arguments can be separated according to usual rules for command-line arguments: spaces are separators, there can be arbitraty number of spaces, and if we want an argument to contain spaces, we must enclose it in double quotes. Command line can also contain the command name followed by arguments. In this case it is treated in the same way, and command can be obtained simply as the first string in the returned array.

Parameters
commandLineCommand line that is split to individual arguments. Command line can also contain a command, which is treated equally.
Returns
An array of arguments.

Referenced by IG.Lib.CommandLineApplicationInterpreter.GetArguments(), and IG.Lib.CommandStackFrameBase.IsEventualListedCommand().

static void IG.Lib.UtilStr.GetArguments ( string  commandLine,
ref List< string >  ret 
)
inlinestatic

Parses a command line and extracts arguments from it. Arguments can be separated according to usual rules for command-line arguments: spaces are separators, there can be arbitraty number of spaces, and if we want an argument to contain spaces, we must enclose it in double quotes. Command line can also contain the command name followed by arguments. In this case it is treated in the same way, and command can be obtained simply as the first string in the returned array.

Parameters
commandLineCommand line that is split to individual arguments. Command line can also contain a command, which is treated equally.
retList in which the parsed arguments are stored.
static void IG.Lib.UtilStr.GetArguments ( string  commandLine,
ref List< string >  ret,
ref List< string >  aux 
)
inlinestaticprivate

Parses a command line and extracts arguments from it. Arguments can be separated according to usual rules for command-line arguments: spaces are separators, there can be arbitraty number of spaces, and if we want an argument to contain spaces, we must enclose it in double quotes. Command line can also contain the command name followed by arguments. In this case it is treated in the same way, and command can be obtained simply as the first string in the returned array.

Parameters
commandLineCommand line that is split to individual arguments. Command line can also contain a command, which is treated equally.
retList in which the parsed arguments are stored.
auxAuxiliary list for storing intermediate results.
static string IG.Lib.UtilStr.RandomUnicodeString ( int  stringLength,
IRandomGenerator  rndgen = null 
)
inlinestatic

Creates and returns a valid random unicode string. All possible uncode characters may be contained in the generated string, EXCEPT the surogate characters in the range 0xD800-0xDFFF.

Unicode surrogate characters in the range 0xD800-0xDFFF (55296-57343) are not valid on their own. They must appear as a pair (0xD800-0xDBFF first, 0xDC00-0xDFFF second) in order to be valid (in the UTF-16 encoding scheme). Alone, they will be treated as invalid characters and decoded to 0xFFFD (65533). C# uses UTF-16 to represent its strings.

See also: http://stackoverflow.com/questions/12127843/generating-a-random-string

Parameters
stringLengthLength of the returned string.
rndgenRandom generator used. If null or unspecified then global random generator is used.
static string IG.Lib.UtilStr.RandomUnicodeString ( int  stringLength,
bool  excludeSurrogates = true,
IRandomGenerator  rndgen = null 
)
inlinestatic

Creates and returns a valid random unicode string. All legal uncode characters may be contained in the generated string.

If surrogates are not excluded then it is not guaranteed that the returned string is og prescribed length.

Unicode surrogate characters in the range 0xD800-0xDFFF (55296-57343) are not valid on their own. They must appear as a pair (0xD800-0xDBFF first, 0xDC00-0xDFFF second) in order to be valid (in the UTF-16 encoding scheme). Alone, they will be treated as invalid characters and decoded to 0xFFFD (65533). C# uses UTF-16 to represent its strings.

See also: http://stackoverflow.com/questions/12127843/generating-a-random-string

Parameters
stringLengthLength of the returned string.
excludeSurrogatesIf true then surrogate characters will not be included in the generated string.
rndgenRandom generator used. If null or unspecified then global random generator is used.

References IG.Num.RandomGenerator.Global.

static char IG.Lib.UtilStr.RandomCharCapitalLetter ( IRandomGenerator  rndgen = null)
inlinestatic

Returns a random character that is a capital letter (A-Z)

Parameters
rndgenRandomg generator used. If null or unspecified then global random generator is used.

References IG.Num.RandomGenerator.Global.

static char IG.Lib.UtilStr.RandomCharSmallLetter ( IRandomGenerator  rndgen = null)
inlinestatic

Returns a random character that is a small letter (a-z)

Parameters
rndgenRandom generator used. If null or unspecified then global random generator is used.

References IG.Num.RandomGenerator.Global.

static char IG.Lib.UtilStr.RandomCharNumeric ( IRandomGenerator  rndgen = null)
inlinestatic

Returns a random numeric character (0-9)

Parameters
rndgenRandom generator used. If null or unspecified then global random generator is used.

References IG.Num.RandomGenerator.Global.

static char IG.Lib.UtilStr.RandomChar ( CharType  typeflags,
IRandomGenerator  rndgen = null 
)
inlinestatic

Returns a random character whose type is specified by type flags. Type flags can be combined by bitwise operations.

Parameters
typeflagsFlags specifying the permitted types of the returned character.
rndgenRandom generator used. If null or unspecified then global random generator is used.
Returns
The randomly generated character.

References IG.Num.RandomGenerator.Global.

Referenced by IG.Lib.UtilConsole.ReadPwdBasic().

static char IG.Lib.UtilStr.RandomChar ( IRandomGenerator  rndgen = null)
inlinestatic

Returns a random character that is either a capital letter (A-Y) or a small letter (a-z). Type flags can be combined by bitwise operations.

Parameters
rndgenRandom generator used. If null or unspecified then global random generator is used.
Returns
The randomly generated character.

References IG.Num.RandomGenerator.Global.

static string IG.Lib.UtilStr.RandomString ( int  length,
CharType  flags,
bool  firstletter,
IRandomGenerator  rndgen = null 
)
inlinestatic

Returns a randomly generated string of a specified length whose characters are of specified type(result). It can also be specified that the first character is a letter.

Parameters
lengthLength of the string.
flagsFlags that determine permitted types of characters contained in the string.
firstletterIf true then first character of the generated string will be a letter. Warning: when the value is true, make sure that either capital or small letters are permitted character type.
rndgenRandom generator used. If null or unspecified then global random generator is used.
Returns
The generated random string.

Referenced by IG.Lib.UtilConsole.Examples().

static string IG.Lib.UtilStr.RandomString ( int  length,
CharType  flags,
IRandomGenerator  rndgen = null 
)
inlinestatic

Returns a randomly generated string of a specified length whose characters are of specified type(result).

Parameters
lengthLength of the string. It is not guaranteed that the first character is a letter.
flagsFlags that determine permitted types of characters contained in the string.
rndgenRandom generator used. If null or unspecified then global random generator is used.
Returns
The generated random string.
static string IG.Lib.UtilStr.RandomString ( int  length,
bool  firstletter,
IRandomGenerator  rndgen = null 
)
inlinestatic

Returns a randomly generated string composed of alphanumeric characters. It can be specified that the first character is a letter.

Parameters
lengthLength of the string.
firstletterIf true then first character of the generated string will be a letter.
rndgenRandom generator used. If null or unspecified then global random generator is used.
Returns
The generated random string.
static string IG.Lib.UtilStr.RandomString ( int  length,
IRandomGenerator  rndgen = null 
)
inlinestatic

Returns a randomly generated string of a specified length containing alphanumeric characters. The first character is a letter.

Parameters
lengthLength of the string.
rndgenRandom generator used. If null or unspecified then global random generator is used.
Returns
The generated random string.
static string IG.Lib.UtilStr.RandomString ( IRandomGenerator  rndgen = null)
inlinestatic

Returns a randomly generated string of a random length containing alphanumeric characters. The first character is a letter. Length is between 1 and the value specified by the MaxStringLength property.

Parameters
rndgenRandom generator used. If null or unspecified then global random generator is used.
Returns
The generated random string.

References IG.Num.RandomGenerator.Global, and IG.Num.IRandomGenerator.Next().

static string IG.Lib.UtilStr.RandomString ( int  stringLength,
string  allowedChars = null,
IRandomGenerator  rndgen = null 
)
inlinestatic

Creates and returns a random string consisting of only the letters contained in the specified string.

Cryptographically secure random numbers are used to select characters for the password from the array of allowed characters.

Parameters
stringLengthLength of the generated password.
allowedCharsString containing allowed characters of the returned string.

By default (if parameter is null or empty string), these are digits and lower- and upper- case English letters.

Parameters
rndgenRandom generator used. If null or unspecified then global random generator is used.
Returns
A random password of specified length.
static bool IG.Lib.UtilStr.IsAscii ( char  ch)
inlinestatic

Returns true if the specified character is an ASCII characters, and false otherwise.

Characters that qualify: from 0 to 255.

Parameters
chCharacter that is querried.
static bool IG.Lib.UtilStr.IsAsciiLetter ( char  ch)
inlinestatic

Returns true if the specified character is an ASCII letter, and false otherwise.

Characters that qualify: from 'a' to 'z' and from 'A' to 'Z'.

Parameters
chCharacter that is querried.
static bool IG.Lib.UtilStr.IsAsciiDigit ( char  ch)
inlinestatic

Returns true if the specified character is an ASCII digit, and false otherwise.

Characters that qualify: from '0' to '9'.

Parameters
chCharacter that is querried.
static bool IG.Lib.UtilStr.IsAsciiLetterOrDigit ( char  ch)
inlinestatic

Returns true if the specified character is either an ASCII letter or an ASCII digit, and false otherwise.

Characters that qualify: from 'a' to 'z', from 'A' to 'Z' and from '0' to '9'.

Parameters
chCharacter that is querried.
static bool IG.Lib.UtilStr.IsVarName ( char[]  str)
inlinestatic

Returns true if the string corresponding to the specified array of characters is a legal standard representation of a variable name, and false otherwise.

Parameters
strArray representation of the string that is queried.
static bool IG.Lib.UtilStr.IsVariableName ( string  str)
inlinestatic

Returns true if the specified string is a legal standard representation of a variable name, and false otherwise.

Parameters
strString that is queried.

Referenced by IG.Num.InputOutputDataDefiniton.GetElementNameParameters().

static bool IG.Lib.UtilStr.IsAsciiString ( char[]  str)
inlinestatic

Returns true if the string corresponding to the specified array of characters is an ASCII string (i.e. it contains only ASCII characters - from 0 to 255), and false otherwise.

True is returned for null or empty strings.

Parameters
strArray representation of the string that is queried.
static bool IG.Lib.UtilStr.IsAsciiString ( string  str)
inlinestatic

Returns true if the string specified string is an ASCII string (i.e. it contains only ASCII characters - from 0 to 255), and false otherwise.

Parameters
strString that is queried.
static bool IG.Lib.UtilStr.ToBoolean ( string  strsetting)
inlinestatic

Converts a string representation of a boolean setting to boolean.

Strings "true", "yes" and "on" (regardless of capitalization) or non-zero integer representations result to true, "false", "no", "off" or zero integer representations result in false.

Parameters
strsettingString representation of the specific setting.
Exceptions
InvalidDataExceptionif the string is not one of recognized representation of a boolean.
Returns
Boolean value corresponding to the setting.

Referenced by IG.Crypto.CryptoManager.AppGetFileHash(), IG.Script.ScriptAppBase.CryptoFunctionGetFileHash_OLD_TO_DELETE(), IG.Neural.NeuralTadej.GetAnalysisRequest(), IG.Num.AnalysisResults.GetAnalysisRequest(), IG.Neural.NeuralTadej.GetAnalysisResult(), IG.Num.AnalysisResults.GetAnalysisResult(), and IG.Lib.SettingsReaderBase.GetBooleanSetting().

static bool IG.Lib.UtilStr.IsBoolean ( string  str)
inlinestatic

Returns a boolean value indicating whether the specified string can represent a boolean value.

Strings "true", "yes" and "on" (regardless of capitalization) or non-zero integer representations result to true, "false", "no", "off" or zero integer representations result in false.

This method is NOT CONSISTENT with bool.TryParse but with UtilStr.ToBoolean.

Parameters
strString that is checked if it can represent a boolean value.
Returns
static long IG.Lib.UtilStr.ToInt ( string  strsetting)
inlinestatic

Converts a string representation of an integer setting to an integer value. If the setting is not defined then 0 is returned.

Parameters
strsettingString representation of the specific setting.
Returns
Long integer value corresponding to the setting.

Referenced by IG.Lib.SettingsReaderBase.GetIntegerSetting().

static long IG.Lib.UtilStr.ToInt ( string  strsetting,
long  defaultvalue 
)
inlinestatic

Converts a string representation of an integer setting to an integer value.

Parameters
strsettingString representation of the specific setting.
defaultvalueDefault value returned in the case that the setting is not defined.
Returns
Long integer value corresponding to the setting.
static bool IG.Lib.UtilStr.IsInt ( string  str)
inlinestatic

Returns a boolean value indicating whether the specified string is a valid representation of an integer number.

Parameters
strString that is checked.
static double IG.Lib.UtilStr.ToDouble ( string  strsetting)
inlinestatic

Converts a string representation of a double setting to an integer value. If the setting is not defined then 0 is returned.

Parameters
strsettingString representation of the value.
Returns
Long integer value corresponding to the setting.

Referenced by IG.Forms.ScalarFunctionEvaluatorControl.DataFromGrid().

static double IG.Lib.UtilStr.ToDouble ( string  strsetting,
long  defaultvalue 
)
inlinestatic

Converts a string representation of a double value to a number of type double.

Parameters
strsettingString representation of the value.
defaultvalueDefault value returned in the case that the string is null or empty.
Returns
Long integer value corresponding to the setting.
static bool IG.Lib.UtilStr.IsDouble ( string  str)
inlinestatic

Returns a boolean value indicating whether the specified string is a valid representation of a number (of type double).

Parameters
strString that is checked.
static string IG.Lib.UtilStr.Load ( string  filePath)
inlinestatic

Loads complete file contents into a stiring and returnes that string.

Parameters
filePathPath to the file that is red into a string.

Referenced by IG.Lib.UtilCsv.LoadCsv().

static void IG.Lib.UtilStr.Load ( string  filePath,
ref string  readString 
)
inlinestatic

Loads complete file contents into the specified stiring.

Parameters
filePathPath to the file that is red into a string.
readStringString variable where file contents is stored.
static void IG.Lib.UtilStr.Save ( string  str,
string  filePath,
bool  append 
)
inlinestatic

Saves the specified string to a specified file. If the specified file does not exists then it is created anew if possible. A boolean argument specifis whether to overwrite existing files or to append the string at the end of the file.

Parameters
strString to be saved to a file.
filePathPath to the file where string is to be saved.
appendIf true then the string is appended at the end of the file in the case that the file already exists. If false then the file is overwritten in the case taht it already exists.

Referenced by IG.Lib.UtilCsv.SaveCsv().

static void IG.Lib.UtilStr.Save ( string  str,
string  filePath 
)
inlinestatic

Saves the specified string to a specified file. If the file already exists then is content is overwritten. If the file does not yet exist then it is created anew.

Parameters
strString to be written to a file.
filePathPath to the file where string is written.
static void IG.Lib.UtilStr.Append ( string  str,
string  filePath 
)
inlinestatic

Saves the specified string to a specified file. If the file already exists then string is appended at the end of the current file contents. If the file does not yet exist then it is created anew.

Parameters
strString to be written to a file.
filePathPath to the file where string is written.

Member Data Documentation

int IG.Lib.UtilStr._maxStringLength = 100
staticprivate

Property Documentation

int IG.Lib.UtilStr.MaxStringLength
staticgetset

Get or sets maximal length for generated strings (must be GREATER THAN 0).


The documentation for this class was generated from the following file: