Deadline Scripting Reference  10.2.1.1
Deadline.Scripting.StringUtils Class Reference

String utility functions. More...

Static Public Member Functions

static string BlankIfEitherIsBlank (string str1, string str2)
 If both strings are non-empty, they are combined and returned as the result. If either string is empty, an empty string is returned. More...
 
static bool ContainsOnlyWordCharacters (string str)
 Returns true if the given string is non-empty, and only contains letters, numbers, underscores, and hyphens. More...
 
static string[] FromCommaSeparatedString (string list)
 Converts a comma separated string into a list of strings. More...
 
static string[] FromCommaSeparatedString (string list, bool allowEmptyTokens)
 Converts a comma separated string into a list of strings. More...
 
static string[] FromSemicolonSeparatedString (string list)
 Converts a semicolon separated string into a list of strings. More...
 
static string[] FromSemicolonSeparatedString (string list, bool allowEmptyTokens)
 Converts a semicolon separated string into a list of strings. More...
 
static string GetDecryptedVncPasswordString (string str)
 Decrypts the password from the given encrypted VNC string. More...
 
static string GetEncryptedVncPasswordString (string password)
 Gets an encrypted VNC password string from the given password. More...
 
static string GetNumeralKeyFromPath (string pathWithNumeralKey, char[] numeralKeyChars)
 Retrieves the numeral key (based on the specified numeral key characters) from the specified path. More...
 
static string GetNumeralKeyFromPath (string pathWithNumeralKey, char[] numeralKeyChars, bool allowEmptyNumeralKey)
 Retrieves the numeral key (based on the specified numeral key characters) from the specified path. More...
 
static bool IsEmpty (string str)
 Checks if the specified string is empty. More...
 
static string Pad (string str, int desiredLength, char fillCharacter)
 Pads the specified string with the fill character to achieve the desired length. More...
 
static bool ParseBoolean (string s)
 Parses a boolean value from the string. Throws an error if a boolean value could not be parsed. More...
 
static bool ParseBooleanWithDefault (string s, bool defaultValue)
 Parses a boolean value from the string. Returns the default value if a boolean value could not be parsed. More...
 
static float ParseLeadingNumber (string s)
 Parses the number at the begining of the specified string. More...
 
static string RemoveWhitespace (string str)
 Removes all whitespace from the specified string, including tabs and end of line characters. More...
 
static string ReplaceNumeralKey (string pathWithNumeralKey, string numeralKey, int index, bool padExtra)
 Replaces the specified numeralKey in the specified path with the specified index. More...
 
static string ToCommaSeparatedString (string[] strings, bool includeSpaces)
 Converts a list of strings to a comma separated string. More...
 
static string ToSemicolonSeparatedString (string[] strings, bool includeSpaces)
 Converts a list of strings to a semicolon separated string. More...
 
static string ToZeroPaddedString (int value, int length)
 Creates a string of the desired length containing the given value, padded with zeros. More...
 
static string ToZeroPaddedString (int value, int length, bool strictLength)
 Creates a string of the desired length containing the given value, padded with zeros. More...
 

Detailed Description

String utility functions.

Member Function Documentation

◆ BlankIfEitherIsBlank()

static string Deadline.Scripting.StringUtils.BlankIfEitherIsBlank ( string  str1,
string  str2 
)
static

If both strings are non-empty, they are combined and returned as the result. If either string is empty, an empty string is returned.

Parameters
str1The first string.
str2The second string.
Returns
The result string.

◆ ContainsOnlyWordCharacters()

static bool Deadline.Scripting.StringUtils.ContainsOnlyWordCharacters ( string  str)
static

Returns true if the given string is non-empty, and only contains letters, numbers, underscores, and hyphens.

Parameters
strThe string.
Returns
True if the string only contains word characters.

◆ FromCommaSeparatedString() [1/2]

static string [] Deadline.Scripting.StringUtils.FromCommaSeparatedString ( string  list)
static

Converts a comma separated string into a list of strings.

Parameters
listThe list as a string.
Returns
An list of strings.

◆ FromCommaSeparatedString() [2/2]

static string [] Deadline.Scripting.StringUtils.FromCommaSeparatedString ( string  list,
bool  allowEmptyTokens 
)
static

Converts a comma separated string into a list of strings.

Parameters
listThe list as a string.
allowEmptyTokensWhether to allow empty tokens in the result.
Returns
An list of strings.

◆ FromSemicolonSeparatedString() [1/2]

static string [] Deadline.Scripting.StringUtils.FromSemicolonSeparatedString ( string  list)
static

Converts a semicolon separated string into a list of strings.

Parameters
listThe list as a string.
Returns
An list of strings.

◆ FromSemicolonSeparatedString() [2/2]

static string [] Deadline.Scripting.StringUtils.FromSemicolonSeparatedString ( string  list,
bool  allowEmptyTokens 
)
static

Converts a semicolon separated string into a list of strings.

Parameters
listThe list as a string.
allowEmptyTokensWhether to allow empty tokens in the result.
Returns
An list of strings.

◆ GetDecryptedVncPasswordString()

static string Deadline.Scripting.StringUtils.GetDecryptedVncPasswordString ( string  str)
static

Decrypts the password from the given encrypted VNC string.

Parameters
strThe encrypted VNC string.
Returns
The decrypted password.

◆ GetEncryptedVncPasswordString()

static string Deadline.Scripting.StringUtils.GetEncryptedVncPasswordString ( string  password)
static

Gets an encrypted VNC password string from the given password.

Parameters
passwordThe password.
Returns
The encrypted string.

◆ GetNumeralKeyFromPath() [1/2]

static string Deadline.Scripting.StringUtils.GetNumeralKeyFromPath ( string  pathWithNumeralKey,
char[]  numeralKeyChars 
)
static

Retrieves the numeral key (based on the specified numeral key characters) from the specified path.

Parameters
pathWithNumeralKeyThe path with a numeral key.
numeralKeyCharsThe character(s) which represent a numerical key. For example: '#' or '?'.
Returns
The numeral key.

◆ GetNumeralKeyFromPath() [2/2]

static string Deadline.Scripting.StringUtils.GetNumeralKeyFromPath ( string  pathWithNumeralKey,
char[]  numeralKeyChars,
bool  allowEmptyNumeralKey 
)
static

Retrieves the numeral key (based on the specified numeral key characters) from the specified path.

Parameters
pathWithNumeralKeyThe path with a numeral key.
numeralKeyCharsThe character(s) which represent a numerical key. For example: '#' or '?'.
allowEmptyNumeralKeyIf False, an error will be thrown if the specified path doesn't contain a numerical key.
Returns
The numeral key.

◆ IsEmpty()

static bool Deadline.Scripting.StringUtils.IsEmpty ( string  str)
static

Checks if the specified string is empty.

Parameters
strThe string.
Returns
True if the string is null or has length of 0.

◆ Pad()

static string Deadline.Scripting.StringUtils.Pad ( string  str,
int  desiredLength,
char  fillCharacter 
)
static

Pads the specified string with the fill character to achieve the desired length.

Parameters
strThe string.
desiredLengthThe desired length.
fillCharacterThe fill character.
Returns
The padded string.

◆ ParseBoolean()

static bool Deadline.Scripting.StringUtils.ParseBoolean ( string  s)
static

Parses a boolean value from the string. Throws an error if a boolean value could not be parsed.

Parameters
sThe string.
Returns
The boolean value.

◆ ParseBooleanWithDefault()

static bool Deadline.Scripting.StringUtils.ParseBooleanWithDefault ( string  s,
bool  defaultValue 
)
static

Parses a boolean value from the string. Returns the default value if a boolean value could not be parsed.

Parameters
sThe string.
defaultValueThe default value.
Returns
The boolean value.

◆ ParseLeadingNumber()

static float Deadline.Scripting.StringUtils.ParseLeadingNumber ( string  s)
static

Parses the number at the begining of the specified string.

Parameters
sThe string.
Returns
The number, or 0 if no number could be found.

◆ RemoveWhitespace()

static string Deadline.Scripting.StringUtils.RemoveWhitespace ( string  str)
static

Removes all whitespace from the specified string, including tabs and end of line characters.

Parameters
strThe string.
Returns
The string without any whitespace.

◆ ReplaceNumeralKey()

static string Deadline.Scripting.StringUtils.ReplaceNumeralKey ( string  pathWithNumeralKey,
string  numeralKey,
int  index,
bool  padExtra 
)
static

Replaces the specified numeralKey in the specified path with the specified index.

Parameters
pathWithNumeralKeyThe path with the numeral key.
numeralKeyThe numeral key to replace.
indexThe number to replace the numeral key with.
padExtraIf True, extra padding will be added if necessary to ensure the entire number is inserted into the numeral key.
Returns
The path with the numeral key replaced.

◆ ToCommaSeparatedString()

static string Deadline.Scripting.StringUtils.ToCommaSeparatedString ( string[]  strings,
bool  includeSpaces 
)
static

Converts a list of strings to a comma separated string.

Parameters
stringsThe string list.
includeSpacesIf spaces should be inserted after each comma.
Returns
The comma separated string.

◆ ToSemicolonSeparatedString()

static string Deadline.Scripting.StringUtils.ToSemicolonSeparatedString ( string[]  strings,
bool  includeSpaces 
)
static

Converts a list of strings to a semicolon separated string.

Parameters
stringsThe string list.
includeSpacesIf spaces should be inserted after each semicolon.
Returns
The semicolon separated string.

◆ ToZeroPaddedString() [1/2]

static string Deadline.Scripting.StringUtils.ToZeroPaddedString ( int  value,
int  length 
)
static

Creates a string of the desired length containing the given value, padded with zeros.

Parameters
valueThe number to pad with zeros.
lengthThe length the resulting string should be.
Returns
The value padded with zeros.

◆ ToZeroPaddedString() [2/2]

static string Deadline.Scripting.StringUtils.ToZeroPaddedString ( int  value,
int  length,
bool  strictLength 
)
static

Creates a string of the desired length containing the given value, padded with zeros.

Parameters
valueThe number to pad with zeros.
lengthThe length the resulting string should be.
strictLengthIf False, an error will be thrown if the result is longer than the given length.
Returns
The value padded with zeros.