| IGLib 1.6.0 The IGLib base library for development of numerical, technical and business applications.

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
Static Public Member Functions | Properties | Static Private Member Functions | Static Private Attributes | List of all members
IG.Lib.UtilStr Class Reference

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

Inheritance diagram for IG.Lib.UtilStr:
[legend]
Collaboration diagram for IG.Lib.UtilStr:
[legend]

## 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 UtilStr.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 UtilStr.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 UtilStr.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 UtilStr.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
| ) |  |
| inline static

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

Parameters

  originals | First array of strings to be compared.
  compared | Second array of strings to be compared.

Type Constraints

  ElementType | : | IComparable<ElementType> |

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

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

  originals | First array of strings to be compared.
  compared | Second array of strings to be compared.

static string [] IG.Lib.UtilStr.GetParametersArrayPlain | ( | string | listString | ) |
| inline static

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

Parameters

  listString | List of parameters in string form, comma separated and with possible whitespaces between them.

Returns

Referenced by IG.Forms.ScalarFunctionScriptControl.txtParameterNames_Validated().

static string IG.Lib.UtilStr.GetParametersStringPlain | ( | string[] | parameters | ) |
| inline static

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

Parameters

  parameters | Array of parameters from which a comma separated list string is formed.

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

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

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

Parameters

  linesString | List of parameters in string form, comma separated and with possible whitespaces between them.

static string IG.Lib.UtilStr.GetLinesStringPlain | ( | string[] | lines | ) |
| inline static

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

Parameters

  lines | Array of parameters from which a comma separated list string is formed.

static string IG.Lib.UtilStr.GetCommandLine | ( | string | CommandName,
|  | string[] | CommandArguments
| ) |  |
| inline static

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

Parameters

  CommandName | Command name.
  CommandArguments | Array of command arguments.

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

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

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

Parameters

  commandNameAndArguments | Array containing command names (0-th element) and its arguments.

static string [] IG.Lib.UtilStr.GetArgumentsArray | ( | string | commandLine | ) |
| inline static

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

  commandLine | Command 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().

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

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

  commandLine | Command line that is split to individual arguments. Command line can also contain a command, which is treated equally.
  ReturnedString | List in which the parsed arguments are stored.

static void IG.Lib.UtilStr.GetArguments | ( | string | commandLine,
|  | ref List< string > | ret,
|  | ref List< string > | aux
| ) |  |
| inline static private

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

  commandLine | Command line that is split to individual arguments. Command line can also contain a command, which is treated equally.
  ReturnedString | List in which the parsed arguments are stored.
  aux | Auxiliary list for storing intermediate results.

static string IG.Lib.UtilStr.RandomUnicodeString | ( | int | stringLength,
|  | IRandomGenerator | rndgen = `null`
| ) |  |
| inline static

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

  stringLength | Length of the returned string.
  rndgen | Random 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`
| ) |  |
| inline static

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

  stringLength | Length of the returned string.
  excludeSurrogates | If true then surrogate characters will not be included in the generated string.
  rndgen | Random 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` | ) |
| inline static

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

Parameters

  rndgen | Randomg 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` | ) |
| inline static

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

Parameters

  rndgen | Random 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` | ) |
| inline static

Returns a random numeric character (0-9)

Parameters

  rndgen | Random 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`
| ) |  |
| inline static

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

Parameters

  typeflags | Flags specifying the permitted types of the returned character.
  rndgen | Random 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.ReadPwd().

static char IG.Lib.UtilStr.RandomChar | ( | IRandomGenerator | rndgen = `null` | ) |
| inline static

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

  rndgen | Random 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`
| ) |  |
| inline static

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

  length | Length of the string.
  flags | Flags that determine permitted types of characters contained in the string.
  firstletter | If 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.
  rndgen | Random 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`
| ) |  |
| inline static

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

Parameters

  length | Length of the string. It is not guaranteed that the first character is a letter.
  flags | Flags that determine permitted types of characters contained in the string.
  rndgen | Random 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`
| ) |  |
| inline static

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

Parameters

  length | Length of the string.
  firstletter | If true then first character of the generated string will be a letter.
  rndgen | Random generator used. If null or unspecified then global random generator is used.
  rndgen | Random 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`
| ) |  |
| inline static

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

Parameters

  length | Length of the string.
  rndgen | Random 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` | ) |
| inline static

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

  rndgen | Random 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`
| ) |  |
| inline static

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

  stringLength | Length of the generated password.
  allowedChars | String 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

  rndgen | Random 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 | ) |
| inline static

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

Characters that qualify: from 0 to 255.

Parameters

  ch | Character that is querried.

static bool IG.Lib.UtilStr.IsAsciiLetter | ( | char | ch | ) |
| inline static

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

  ch | Character that is querried.

static bool IG.Lib.UtilStr.IsAsciiDigit | ( | char | ch | ) |
| inline static

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

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

Parameters

  ch | Character that is querried.

static bool IG.Lib.UtilStr.IsAsciiLetterOrDigit | ( | char | ch | ) |
| inline static

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

  ch | Character that is querried.

static bool IG.Lib.UtilStr.IsVarName | ( | char[] | str | ) |
| inline static

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

  str | Array representation of the string that is queried.

static bool IG.Lib.UtilStr.IsVariableName | ( | string | str | ) |
| inline static

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

Parameters

  str | String that is queried.

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

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

  str | Array representation of the string that is queried.

static bool IG.Lib.UtilStr.IsAsciiString | ( | string | str | ) |
| inline static

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

  str | String that is queried.

static bool IG.Lib.UtilStr.ToBoolean | ( | string | strsetting | ) |
| inline static

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

  strsetting | String representation of the specific setting.

Exceptions

  InvalidDataException | if 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 | ) |
| inline static

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

  str | String that is checked if it can represent a boolean value.

Returns

static long IG.Lib.UtilStr.ToInt | ( | string | strsetting | ) |
| inline static

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

Parameters

  strsetting | String 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
| ) |  |
| inline static

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

Parameters

  strsetting | String representation of the specific setting.
  defaultvalue | Default 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 | ) |
| inline static

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

Parameters

  str | String that is checked.

static double IG.Lib.UtilStr.ToDouble | ( | string | strsetting | ) |
| inline static

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

Parameters

  strsetting | String 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
| ) |  |
| inline static

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

Parameters

  strsetting | String representation of the value.
  defaultvalue | Default 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 | ) |
| inline static

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

Parameters

  str | String that is checked.

static string IG.Lib.UtilStr.Load | ( | string | filePath | ) |
| inline static

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

Parameters

  inputFilePath | Path 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
| ) |  |
| inline static

Loads complete file contents into the specified stiring.

Parameters

  inputFilePath | Path to the file that is red into a string.
  readString | String variable where file contents is stored.

static void IG.Lib.UtilStr.Save | ( | string | str,
|  | string | filePath,
|  | bool | append
| ) |  |
| inline static

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

  str | String to be saved to a file.
  inputFilePath | Path to the file where string is to be saved.
  append | If 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
| ) |  |
| inline static

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

  str | String to be written to a file.
  inputFilePath | Path to the file where string is written.

static void IG.Lib.UtilStr.Append | ( | string | str,
|  | string | filePath
| ) |  |
| inline static

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

  str | String to be written to a file.
  inputFilePath | Path to the file where string is written.

## Member Data Documentation

int IG.Lib.UtilStr._maxStringLength = 100
| static private

## Property Documentation

int IG.Lib.UtilStr.MaxStringLength
| static get set

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

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

- igbase/utilities/UtilString.cs