DDDriverStringCommands

Last Updated:

Driver Commands for String Manipulations

Driver Command record format:
Field #1
The "C" = DRIVER COMMAND record type specifier.
Field #2
The Driver Command keyword.

Example:

c , SetApplicationMap , "AppMap.map"


[How To Read This Reference]
CleanString
RJ TID SDC RC SE2
CleanString, for each char in string: if ((char .gt. 31) and (char .lt. 127)) keep it, otherwise turn it into a space
Compare
RJ TID SDC SE2
Compares two strings and returns an integer specifying the result of the comparison. The java version returns 'true' or 'false' as the result.
Concatenate
RJ TID SDC RC SE2
Concatenate String1 with String2 and returns concatenated string.
GetField
RC RJ TID SDC SE2
GetField, get a field out of a string using specified delimiter(s). Note that any leading or trailing whitespaces are still present.
GetFieldCount
RJ TID SDC RC SE2
GetFieldCount, Finds the count of all fields within the inputRecord found from startindex to the end of the inputRecord.
GetFixedWidthField
RJ TID SDC RC SE2
GetFixedWidthField, Given an Input of fixed-width fields, return the nth(FieldID) Field in the record.
GetMultiDelimitedField
RJ TID SDC RC SE2
Given a sourceString of delimited fields, return the nth(FieldID) Field in the record from startIndex. The startIndex and fieldID are 1 based.
GetMultiDelimitedFieldCount
RJ TID SDC RC SE2
Finds the count of all fields within the inputRecord found from startindex to the end of the inputRecord. The field and index are 1-based.
GetNextDelimiterIndex
RJ TID SDC RC SE2
GetNextDelimiterIndex, Finds the index of the first character matching one of the provided delimiter characters. The search begins at startindex within the inputRecord.
GetREDelimitedField
RJ TID SDC SE2
GetREDelimitedField, this command returns the requested field contained in the input string using the passed in regular expression as the delimiter(s).
GetREDelimitedFieldCount
RJ TID SDC SE2
GetREDelimitedFieldCount, this command returns the number of fields contained in the input string using the passed in regular expression as the delimiter(s).
GetSubstringsInString
RJ TID SDC SE2
Extract dynamic substring from a string using regular expressions.
GetSystemEnviron
RJ RC TID SDC SE2
GetSystemEnviron, get a system environment variable value
GetSystemUser
RJ TID SDC RC SE2
Get the USERID of the currently logged on user as stored in System Environment variables.
GetTrimmedField
RJ TID SDC RC SE2
GetTrimmedField, get a trimmed field out of a string using specified delimiter(s).
Index
RJ TID SDC RC SE2
Returns the position of the first occurrence of one string within another string. -1 if not found at all
Left
RJ TID SDC RC SE2
Returns a string of a specified number of characters copied from the beginning of another string.
LeftTrim
RJ TID SDC RC SE2
A new string trimmed of leading tabs and spaces.
Length
RJ TID SDC RC SE2
Returns the length of a string or variable.
Replace
RJ TID SDC RC SE2
Replace 'find' substring with 'replace' substring
Right
RJ TID SDC RC SE2
Returns a string of a specified number of characters copied from the end of another string.
RightTrim
RJ TID SDC RC SE2
A new string trimmed of trailing tabs and spaces.
SubString
RJ TID SDC RC SE2
Returns a portion of a string based on character index.
ToLowerCase
RJ TID SDC RC SE2
Returns a copy of a string, with all letters converted to lowercase.
ToUpperCase
RJ TID SDC RC SE2
Returns a copy of a string after converting all letters to uppercase.
Trim
RJ TID SDC RC SE2
A new string trimmed of leading and trailing tabs and spaces.

DDDriverStringCommands::CleanString
RJ TID SDC RC SE2

CleanString, for each char in string: if ((char .gt. 31) and (char .lt. 127)) keep it, otherwise turn it into a space


Fields: [ ]=Optional with Default Value
  1. sourceString
    sourceString (could come from a ^variable)


  2. resultVar
    the resultVar to place the result of the operation into


Examples:
  • C, cleanString, "a^Abcd", var
    variable 'var' should contain 'a bcd' after this is run (note that ^A is a Control-A, not the actual chars ^ and A)


[How To Read This Reference]

DDDriverStringCommands::Compare
RJ TID SDC SE2

Compares two strings and returns an integer specifying the result of the comparison. The java version returns 'true' or 'false' as the result.

For java version, if the parameter 'regexMatch' is true, then the parameter 'dstString' is considered as regular expression.

Fields: [ ]=Optional with Default Value
  1. sourceString
    The source string (could come from a ^variable) to compare.


  2. dstString
    The destination string (could come from a ^variable) to compare.

    This is normally a simple string;
    But it could be a regular expression if the parameter 'regexMatch' is true. Do NOT forget the leading symbol ^ and the ending symbol $ if the whole string should be considered; Without them, if a sub-string of the 'sourceString' can match the regex pattern, then it is considered matched.


  3. resultVar
    the resultVar to place the result of the operation into


  4. [ regexMatch = false ]
    Indicates if the comparison is in regex way.

    This parameter is optional, the default value is false. If this is true, then the parameter 'dstString' should be provided with a regular expression. Else if this is false or not provided, the parameter 'dstString' will be treated as a normal string even if it is provided with a regular expression.

Examples:
  • C, Compare, "abc", "abcd", var
    variable 'var' should contain 'false'


  • C, Compare, "Hi, Hello World with happy", "[H|h]ello [W|w]orld", var, true
    variable 'var' should contain 'true', as sub-string "Hello World" of the source string "Hi, Hello World with happy" can match the regex pattern "[H|h]ello [W|w]orld"


  • C, Compare, "Hi, Hello World with happy", "^[H|h]ello [W|w]orld$", var, true
    variable 'var' should contain 'false'. With leading symbol ^ and ending symbol $, it is expected that the whole string of "Hi, Hello World with happy" matches with the regex pattern "^[H|h]ello [W|w]orld$", but it does not unfortunately.


[How To Read This Reference]

DDDriverStringCommands::Concatenate
RJ TID SDC RC SE2

Concatenate String1 with String2 and returns concatenated string.


Fields: [ ]=Optional with Default Value
  1. string1
    string1 (could come from a ^variable)


  2. string2
    string2 (could come from a ^variable)


  3. resultVar
    the resultVar to place the result of the operation into


Examples:
  • C, Concatenate, "abc", "def", var
    variable 'var' should contain 'abcdef' after this is run


[How To Read This Reference]

DDDriverStringCommands::GetField
RC RJ TID SDC SE2

GetField, get a field out of a string using specified delimiter(s). Note that any leading or trailing whitespaces are still present.


Fields: [ ]=Optional with Default Value
  1. InputString
    The input string which contains the field to be returned


  2. index
    0-based index of which field to return


  3. delimiter
    delimiter(s) - one or more single characters used as delimiters


  4. resultVar
    the variable name to store the returned field in


Examples:
  • C, getTrimmedField, "a|bc|d", 1, "|", var
    variable 'var' should contain 'bc' after this is run


[How To Read This Reference]

DDDriverStringCommands::GetFieldCount
RJ TID SDC RC SE2

GetFieldCount, Finds the count of all fields within the inputRecord found from startindex to the end of the inputRecord.


Fields: [ ]=Optional with Default Value
  1. String1
    String1 to parse and count fields


  2. startindex
    0-based startindex for parsing the string.


  3. delimiters
    delimiters -- each character is treated as a separate delimiter.


  4. resultVar
    the resultVar to place the result of the operation into


Examples:
  • C, GetFieldCount, "a|bc|d", 0, "|", var
    variable 'var' should contain 3 after this is run


[How To Read This Reference]

DDDriverStringCommands::GetFixedWidthField
RJ TID SDC RC SE2

GetFixedWidthField, Given an Input of fixed-width fields, return the nth(FieldID) Field in the record.


Fields: [ ]=Optional with Default Value
  1. sourceString
    sourceString (could come from a ^variable)


  2. fieldID
    0-based field to retrieve. from 0.


  3. fixedwidth
    the fixedwidth alotted for each field in the record


  4. resultVar
    the resultVar to place the result of the operation into


Examples:
  • C, getFixedWidthField, "abcdef", 1, 2, var
    variable 'var' should contain 'cd' after this is run


[How To Read This Reference]

DDDriverStringCommands::GetMultiDelimitedField
RJ TID SDC RC SE2

Given a sourceString of delimited fields, return the nth(FieldID) Field in the record from startIndex. The startIndex and fieldID are 1 based.


Fields: [ ]=Optional with Default Value
  1. sourceString
    Source string in which to search for first delimited character


  2. FieldID
    The one based index of the field to find and return.


  3. StartIndex
    Integer (1-based) start position for search in sourceString


  4. Delimiters
    String list of delimiters to find


  5. ResultVar

    Name of DDVariable that will receive the result.



Examples:
  • C, GetMultiDelimitedField, "a->b->c->d->e->f>", 2, 5, "->", "field"
    Start from 5th posistion of string "a->b->c->d->e->f>" to search the second tokens delimited by "->". Then it will save the token to the variable "field". In this example, the token found will be "c".


[How To Read This Reference]

DDDriverStringCommands::GetMultiDelimitedFieldCount
RJ TID SDC RC SE2

Finds the count of all fields within the inputRecord found from startindex to the end of the inputRecord. The field and index are 1-based.


Fields: [ ]=Optional with Default Value
  1. String1
    Source String in which to search for first delimited character


  2. StartIndex
    Integer (1-based) start position for search in inputRecord


  3. Delimiters
    String list of delimiters to find


  4. ResultVar

    Name of DDVariable to receive the result



Examples:
  • C, GetMultiDelimitedFieldCount, string1, index, delimiter, "result"
    ^result = number of fields counted starting at index as seperated by delimiter delimeter can be more than 1 character


[How To Read This Reference]

DDDriverStringCommands::GetNextDelimiterIndex
RJ TID SDC RC SE2

GetNextDelimiterIndex, Finds the index of the first character matching one of the provided delimiter characters. The search begins at startindex within the inputRecord.


Fields: [ ]=Optional with Default Value
  1. String1
    String1 to parse for field delimiters


  2. startindex
    0-based startindex to begin parsing the string.


  3. delimiters
    delimiters -- each character is treated as a separate delimiter.


  4. resultVar
    the resultVar to place the result of the operation into


Examples:
  • C, GetNextDelimiterIndex, "a/|/", 0, "|/", var
    variable 'var' should contain 1 after this is run


[How To Read This Reference]

DDDriverStringCommands::GetREDelimitedField
RJ TID SDC SE2

GetREDelimitedField, this command returns the requested field contained in the input string using the passed in regular expression as the delimiter(s).


Fields: [ ]=Optional with Default Value
  1. InputString
    The input string to analyze.


  2. index
    1-based index of the field to return from the input string.


  3. RegExp
    RegExp - This string contains a regular expression used as the delimiter(s). These should conform to the regular expressions defined in "java.util.regex.Pattern" documentation.


  4. resultVar
    resultVar contains the requested field from the input string.


Examples:
  • C, GetREDelimitedField, "All is    well in      the  world", 4, "\s+", var
    This is equivalent to asking for one of the non-blank fields in the string. Variable 'var' should contain "in" after this is run.


  • C, GetREDelimitedField, "RedXXOrangeXXYellowXXGreenXXBlueXXIndigoXXViolet", 2, "XX", var
    This uses the string "XX" as the delimiter. Variable 'var' should contain "Orange" after this is run.


  • C, GetREDelimitedField, "a|b&cd-efghi", 3, "[\|&\-g]", var
    variable 'var' should contain "cd" after this is run. Fields in the string are: "a", "b", "cd", "ef", "hi".


[How To Read This Reference]

DDDriverStringCommands::GetREDelimitedFieldCount
RJ TID SDC SE2

GetREDelimitedFieldCount, this command returns the number of fields contained in the input string using the passed in regular expression as the delimiter(s).


Fields: [ ]=Optional with Default Value
  1. InputString
    The input string to analyze.


  2. index
    0-based index of where to start the analysis from. The index should be less than or equal to the length of the input string.


  3. RegExp
    RegExp - This string contains a regular expression used as the delimiter(s). These should conform to the regular expressions defined in "java.util.regex.Pattern" documentation.


  4. resultVar
    resultVar contains the number of fields in the input string.


Examples:
  • C, GetREDelimitedFieldCount, "All is    well in      the  world", 4, "\s+", var
    This is equivalent to asking for the count of non-blank fields in the string. Variable 'var' should contain 6 after this is run.


  • C, GetREDelimitedFieldCount, "a|b&cd-efghi", 0, "[\|&\-g]", var
    variable 'var' should contain 5 after this is run. Fields are: "a", "b", "cd", "ef", "hi".


[How To Read This Reference]

DDDriverStringCommands::GetSubstringsInString
RJ TID SDC SE2

Extract dynamic substring from a string using regular expressions.

This command sets a DDVariable for each substring formed between regexstart and regexstop (1 match per string, currently). Both regexstart and regexstop must be valid, non-empty strings or no matching substring will be found.

The string is parsed, searching the substring between regexstart and regexstop matches.

When a match is found, the string between regexstart and regexstop is saved in a newly created DDVariable with the name given in varname.



Fields: [ ]=Optional with Default Value
  1. String
    String to search for substring.


  2. RegexStart
    The starting regular expression. Should not be empty.


  3. RegexStop
    The stopping regular expression. Should not be empty.


  4. VarName
    The name of the variable to contain the substring.


Examples:
  • C GetSubstringsInString "XaaaB" ^regexstart="X" ^regexstop="B" ^VarName="MyVar"
    Sets variable MyVar to value "aaa".


[How To Read This Reference]

DDDriverStringCommands::GetSystemEnviron
RJ RC TID SDC SE2

GetSystemEnviron, get a system environment variable value


Fields: [ ]=Optional with Default Value
  1. string1
    String1


  2. resultVar
    the resultVar to place the result of the operation into


Examples:
  • C, GetSystemEnviron, "OS", var
    variable 'var' should contain something like 'Windows_NT' after this is run


[How To Read This Reference]

DDDriverStringCommands::GetSystemUser
RJ TID SDC RC SE2

Get the USERID of the currently logged on user as stored in System Environment variables.


Fields: [ ]=Optional with Default Value
  1. resultVar
    the resultVar to place the USERID into


Examples:
  • C, GetSystemUser, var
    variable 'var' should contain the logged in userid after this is run


[How To Read This Reference]

DDDriverStringCommands::GetTrimmedField
RJ TID SDC RC SE2

GetTrimmedField, get a trimmed field out of a string using specified delimiter(s).


Fields: [ ]=Optional with Default Value
  1. string1
    string1


  2. index
    0-based index of which field to grab


  3. delimiter
    delimiter


  4. resultVar
    the resultVar to place the result of the operation into


Examples:
  • C, getTrimmedField, "a|bc|d", 1, "|", var
    variable 'var' should contain 'bc' after this is run


[How To Read This Reference]

DDDriverStringCommands::Index
RJ TID SDC RC SE2

Returns the position of the first occurrence of one string within another string. -1 if not found at all


Fields: [ ]=Optional with Default Value
  1. start
    0-based starting offset of the sourceString to search


  2. sourceString
    sourceString (could come from a ^variable)


  3. findString
    findString (could come from a ^variable)


  4. resultVar
    the resultVar to place the result of the operation into


Examples:
  • C, Index, 0, "abc", "bc", var
    variable 'var' should contain 1 after this is run


[How To Read This Reference]

DDDriverStringCommands::Left
RJ TID SDC RC SE2

Returns a string of a specified number of characters copied from the beginning of another string.


Fields: [ ]=Optional with Default Value
  1. sourceString
    sourceString (could come from a ^variable)


  2. length
    number of chars to copy


  3. resultVar
    the resultVar to place the result of the operation into


Examples:
  • C, Left, abc, 1, ^resultString
    variable 'resultString' should contain 'a' after this is run


[How To Read This Reference]

DDDriverStringCommands::LeftTrim
RJ TID SDC RC SE2

A new string trimmed of leading tabs and spaces.


Fields: [ ]=Optional with Default Value
  1. sourceString
    sourceString (could come from a ^variable)


  2. resultVar
    the resultVar to place the result of the operation into


Examples:
  • C, LeftTrim, " abc", var
    variable 'var' should contain 'abc' after this is run


[How To Read This Reference]

DDDriverStringCommands::Length
RJ TID SDC RC SE2

Returns the length of a string or variable.


Fields: [ ]=Optional with Default Value
  1. sourceString
    sourceString (could come from a ^variable)


  2. resultVar
    the resultVar to place the result of the length operation into


Examples:
  • C, Length, "abc", lengthVar
    variable lengthVar should contain 3 after this is run


[How To Read This Reference]

DDDriverStringCommands::Replace
RJ TID SDC RC SE2

Replace 'find' substring with 'replace' substring


Fields: [ ]=Optional with Default Value
  1. sourceString
    sourceString (could come from a ^variable)


  2. findString
    findString (could come from a ^variable)


  3. replaceString
    replaceString (could come from a ^variable)


  4. resultVar
    the resultVar to place the result of the operation into


Examples:
  • C, Replace, "abc", "bc", "234", var
    variable 'var' should contain 'a234' after this is run


[How To Read This Reference]

DDDriverStringCommands::Right
RJ TID SDC RC SE2

Returns a string of a specified number of characters copied from the end of another string.


Fields: [ ]=Optional with Default Value
  1. sourceString
    sourceString (could come from a ^variable)


  2. length
    length


  3. resultVar
    the resultVar to place the result of the operation into


Examples:
  • C, Right, "abc", 2, var
    variable 'var' should contain 'bc' after this is run


[How To Read This Reference]

DDDriverStringCommands::RightTrim
RJ TID SDC RC SE2

A new string trimmed of trailing tabs and spaces.


Fields: [ ]=Optional with Default Value
  1. sourceString
    sourceString (could come from a ^variable)


  2. resultVar
    the resultVar to place the result of the operation into


Examples:
  • C, RightTrim, "abc ", var
    variable 'var' should contain 'abc' after this is run


[How To Read This Reference]

DDDriverStringCommands::SubString
RJ TID SDC RC SE2

Returns a portion of a string based on character index.

The substring to retrieve starts at the specified start character index and ends after the specified number of characters have been copied. If the number of characters to copy is not provided, then we will return all characters after the start index.

Fields: [ ]=Optional with Default Value
  1. sourceString
    sourceString (could come from a ^variable)


  2. start
    starting 0-based offset character position


  3. [ length = ]
    number of chars to copy. If not provided or less than 1 then all characters after the start index will be retrieved.


  4. resultVar
    the resultVar to place the result of the operation into


Examples:
  • C, SubString, "abc", 1, 1, var
    variable 'var' should contain 'b' after this is run


[How To Read This Reference]

DDDriverStringCommands::ToLowerCase
RJ TID SDC RC SE2

Returns a copy of a string, with all letters converted to lowercase.


Fields: [ ]=Optional with Default Value
  1. sourceString
    sourceString (could come from a ^variable)


  2. resultVar
    the resultVar to place the result of the operation into


Examples:
  • C, ToLowerCase, "ABC", var
    variable 'var' should contain 'abc' after this is run


[How To Read This Reference]

DDDriverStringCommands::ToUpperCase
RJ TID SDC RC SE2

Returns a copy of a string after converting all letters to uppercase.


Fields: [ ]=Optional with Default Value
  1. sourceString
    sourceString (could come from a ^variable)


  2. resultVar
    the resultVar to place the result of the operation into


Examples:
  • C, ToUpperCase, "abc", var
    variable 'var' should contain 'ABC' after this is run


[How To Read This Reference]

DDDriverStringCommands::Trim
RJ TID SDC RC SE2

A new string trimmed of leading and trailing tabs and spaces.


Fields: [ ]=Optional with Default Value
  1. sourceString
    sourceString (could come from a ^variable)


  2. resultVar
    the resultVar to place the result of the operation into


Examples:
  • C, Trim, " abc ", var
    variable 'var' should contain 'abc' after this is run


[How To Read This Reference]