StringMethods class | QSYS API Reference Guide
Estimated reading time: 57 minutes
Contains extension methods for handling RPG operations and conversions for string values.
Namespace: ASNA.QSys.Runtime
Assembly: ASNA.QSys.Runtime.dll
Inheritance: Object
Methods
Signature |
Description |
AdjustEnd(String, Int32) |
Adjust the length of a string to a given value, by padding or truncating the string on the right. |
AdjustStart(String, Int32) |
Adjust the length of a string to a given value, by padding or truncating the string on the left. |
AdjustVaryingLength(String, Int32) |
Trims the end of a variable length string if needed so the string is at most as long as limit. |
BitOff(Byte, String) |
RPG’s BITOFF. |
BitOn(Byte, String) |
RPG’s BITON. |
CheckCharacters(String, String, Int32) |
RPG’s CHECK. Verifies that each character in a base string or array is among the characters in the comparator string. |
CheckCharacters(String, String, Int32, Array) |
RPG’s CHECK. Verifies that each character in a base string or array is among the characters in the comparator string. |
CheckCharactersReverse(String, String, Int32) |
RPG’s CHECKR. Verifies that each character in a base string or array is among the characters in the comparator string. |
CheckCharactersReverse(String, String, Int32, Array) |
RPG’s CHECKR. Verifies that each character in a base string or array is among the characters in the comparator string. |
CheckPosition(String, String) |
RPG’s %CHECK. Verifies that each character in the baseString is among the characters in the comparator. |
CheckPosition(String, String, Int32) |
RPG’s %CHECK. Verifies that each character in the baseString is among the characters in the comparator. |
CheckPositionReverse(String, String, Int32) |
RPG’s %CHECK. Verifies that each character in the baseString is among the characters in the comparator, starting from the right most position. |
CheckPositionReverse(String, String) |
RPG’s %CHECK. Verifies that each character in the baseString is among the characters in the comparator, starting from the right most position. |
FromStringBinary(String, Int32, Int32) |
Returns a (binary) decimal number based on its ‘memory’ representation. |
FromStringByte(String) |
Returns a byte based on its ‘memory’ representation. |
FromStringInteger(String) |
Returns an integer number based on its ‘memory’ representation. |
FromStringLong(String) |
Returns a long number based on its ‘memory’ representation. |
FromStringPacked(String, Int32) |
Returns a (packed) decimal number based on its ‘memory’ representation. |
FromStringShort(String) |
Returns a short number based on its ‘memory’ representation. |
FromStringZoned(String, Int32, Int32) |
Returns a (zoned) decimal number based on its ‘memory’ representation. |
IsBlanks(String) |
Test a string to see if it is spaces. |
MoveLeft(String, Decimal, Int32, Int32) |
RPG’s MOVEL. Moves left a numeric string to decimal, without pad. |
MoveLeft(String, String) |
RPG’s MOVEL. Moves left a string to string, with or without pad. |
MoveLeft(String, DateTime, DateTimeDataKind, DateTimeFormat, DateTimeSeparator) |
RPG’s MOVEL. Moves left a string expressed in the given format into a date time type. |
MoveLeft(String, Int16) |
RPG’s MOVEL. Moves left a numeric string into an int2 (short). |
MoveLeft(String, Int32) |
RPG’s MOVEL. Moves left a numeric string into an int4 (int). |
MoveLeft(String, Int64) |
RPG’s MOVEL. Moves left a numeric string into an int8 (long). |
MoveLeftToChar(String) |
RPG’s MOVE. Moves left a string into a character. |
MoveLeftWithPad(String, Decimal, Int32, Int32) |
RPG’s MOVEL. Moves left a numeric string to decimal, with pad. |
MoveLeftWithPad(String, String) |
RPG’s MOVEL. Moves left a string to string, with pad. |
MoveLeftWithPad(String, Int16) |
RPG’s MOVEL. Moves left a numeric string into an int2 (short) with pad. |
MoveLeftWithPad(String, Int32) |
RPG’s MOVEL. Moves left a numeric string into an int4 (int) with pad. |
MoveLeftWithPad(String, Int64) |
RPG’s MOVEL. Moves right a numeric string into an int8 (long) with pad. |
MoveRight(String, Decimal, Int32, Int32) |
RPG’s MOVE. Moves right a numeric string to decimal, without pad. |
MoveRight(String, String) |
RPG’s MOVE. Moves right a string to string, without pad. |
MoveRight(String, DateTime, DateTimeDataKind, DateTimeFormat, DateTimeSeparator) |
RPG’s MOVE. Moves right a string expressed in the given format into a date time type. |
MoveRight(String, Int16) |
RPG’s MOVE. Moves right a numeric string into an int2 (short). |
MoveRight(String, Int32) |
RPG’s MOVE. Moves right a numeric string into an int4 (int). |
MoveRight(String, Int64) |
RPG’s MOVE. Moves right a numeric string into an int8 (long). |
MoveRightToChar(String) |
RPG’s MOVE. Moves right a string into a character. |
MoveRightWithPad(String, Decimal, Int32, Int32) |
RPG’s MOVE. Moves right a numeric string to decimal, with pad. |
MoveRightWithPad(String, String) |
RPG’s MOVE. Moves right a string to string, with pad. |
MoveRightWithPad(String, Int16) |
RPG’s MOVE. Moves right a numeric string into an int2 (short) with pad. |
MoveRightWithPad(String, Int32) |
RPG’s MOVE. Moves right a numeric string into an int4 (int) with pad. |
MoveRightWithPad(String, Int64) |
RPG’s MOVE. Moves right a numeric string into an int8 (long) with pad. |
MoveToArray(String, Array, Int32) |
Moves a source string into an array. |
MoveToArrayWithPad(String, Array, Int32) |
Moves a source string into an array. |
Replace(String, String, Int32, Int32, Boolean) |
RPG’s %SUBST. Replaces characters in a string based on position and length. |
Replace(String, String, Int32, Boolean) |
RPG’s %SUBST. Replaces characters in a string based on position and length. |
Replace(String, String, Int32, Int32) |
RPG’s %SUBST. Replaces characters in a string based on position and length. |
ReplaceFixed(String, Int32, String, Int32, Int32) |
RPG’s %SUBST. Replaces characters in a string based on position and length. |
ScanString(String, String, Int32) |
RPG’s %SCAN. Returns the first position of the search argument in the source string, or 0 if it was not found. |
ScanString(String, String) |
RPG’s %SCAN. Returns the first position of the search argument in the source string, or 0 if it was not found. |
ScanString(String, String, Int32, Int32) |
RPG’s SCAN. Attempts to find cmpStr in the baseString. |
ScanString(String, String, Int32, Int32, Array) |
RPG’s SCAN. Attempts to find cmpStr in the baseString. |
SetHiLoEq(String, Indicator&, Indicator&, Indicator&) |
Sets the flags according to the value of testString. |
SetVaryingLength(String, Int32, Int32) |
Sets the variable length string to the indicated length, ensuring that it is no longer than limit. |
SubStr(String, Int32, Int32) |
RPG’s SUBST. Returns a substring from baseString, starting at startPos ending at subLen, puts it into target, no padding, no preservation of length. |
SubStrFixed(String, Int32, Int32, String) |
RPG’s SUBST. Returns a substring from baseString, starting at startPos ending at subLen, puts it into target. This function preserves the length of the target, no padding. |
SubStrFixedWithPad(String, Int32, Int32, String) |
RPG’s SUBST. Returns a substring from baseString, starting at startPos ending at subLen, puts it into target. This function preserves the length of the target, and pads the result. |
ToByte(String) |
Converts a numeric string into a byte number. |
ToDateTime(String, DateTimeDataKind, DateTimeFormat, DateTimeSeparator) |
Converts a string representation of a date/time/timestamp into a DateTime. |
ToDouble(String) |
Converts a numeric string into a double number. |
ToFixedDecimal(String, Int32, Int32) |
Converts a numeric string into a RPG decimal. |
ToFixedDecimalRounded(String, Int32, Int32) |
Converts a numeric string into a RPG decimal with rounding (half adjust). |
ToFloat(String) |
Converts a numeric string into a float number. |
ToInt16(String) |
Converts a numeric string into a short number. |
ToInt32(String) |
Converts a numeric string into an int number. |
ToInt64(String) |
Converts a numeric string into a long number. |
ToPackedDecimal(String, Int32) |
Converts a string representing a packed number into a RPG decimal. |
ToZonedDecimal(String, Int32, Int32) |
Converts a zoned representation string into a RPG decimal. |
Xlate(String, String, String, Int32) |
RPG’s %Xlate. Translates baseString according to the values of mapFrom, mapTo, and startPos. |
Xlate(String, String, String, String, Int32) |
RPG’s XLATE. Translates characters in the baseString according to MapFrom, MapTo, startPos and targetString, no padding, no preservation of length. |
XlateFixed(String, String, String, String, Int32) |
RPG’s XLATE. Translates characters in the baseString according to MapFrom, MapTo, startPos and targetString. This version preserves the length of the result, does NOT pad. |
XlateFixedWithPad(String, String, String, String, Int32) |
RPG’s XLATE. Translates characters in the baseString according to MapFrom, MapTo, startPos and targetString. This version preserves the length of the result, with padding. |
Adjust the length of a string to a given value, by padding or truncating the string on the right.
string AdjustEnd(string charStr, int length)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
The string to adjust. |
Int32 |
length |
The desired length. |
Returns
Type |
Description |
String |
The string at the desired length. |
Adjust the length of a string to a given value, by padding or truncating the string on the left.
string AdjustStart(string charStr, int length)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
The string to adjust. |
Int32 |
length |
The desired length. |
Returns
Type |
Description |
String |
The string at the desired length. |
Trims the end of a variable length string if needed so the string is at most as long as limit.
string AdjustVaryingLength(string charStr, int limit)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
A variable length string. |
Int32 |
limit |
Maximum length allowed for the string. |
Returns
Type |
Description |
String |
The string value with length at most equal to limit. |
RPG’s BITOFF.
byte BitOff(byte target, string mask)
Parameters
Type |
Parameter name |
Description |
Byte |
target |
A one-position character field. |
String |
mask |
Bit numbers 0-7. Enclose the bit numbers in apostrophes. For example, to set bits 0, 3, 6 on, enter ‘036’. A valid character expression. |
Returns
Type |
Description |
Byte |
Returns the result of bitoff mask being applied to the target. |
RPG’s BITON.
byte BitOn(byte target, string mask)
Parameters
Type |
Parameter name |
Description |
Byte |
target |
A one-position character field. |
String |
mask |
Bit numbers 0-7. Enclose the bit numbers in apostrophes. For example, to set bits 0, 3, 6 on, enter ‘036’. A valid character expression. |
Returns
Type |
Description |
Byte |
Returns the result of biton mask being applied to the target. |
RPG’s CHECK. Verifies that each character in a base string or array is among the characters in the comparator string.
bool CheckCharacters(string baseString, string comparator, int startPos)
Parameters
Type |
Parameter name |
Description |
String |
baseString |
A character expression that contains the string to compare with comparator. |
String |
comparator |
A character expression that is used to compare against the baseString. |
Int32 |
startPos |
Specifies the 1-based starting position and continues to the right of the baseString. |
Returns
Type |
Description |
Boolean |
Returns true if a mismatch is found. |
RPG’s CHECK. Verifies that each character in a base string or array is among the characters in the comparator string.
bool CheckCharacters(string baseString, string comparator, int startPos, Array noMatchArray)
Parameters
Type |
Parameter name |
Description |
String |
baseString |
A character expression that contains the string to compare with comparator. |
String |
comparator |
A character expression that is used to compare against the baseString. |
Int32 |
startPos |
Specifies the 1-based starting position and continues to the right of the baseString. |
Array |
noMatchArray |
Returns all of the 1-based positions of characters that don’t match. The first element in the array contains the leftmost non-match. |
Returns
Type |
Description |
Boolean |
Returns true if a mismatch is found. |
RPG’s CHECKR. Verifies that each character in a base string or array is among the characters in the comparator string.
bool CheckCharactersReverse(string baseString, string comparator, int startPos)
Parameters
Type |
Parameter name |
Description |
String |
baseString |
A character expression that contains the string to compare with comparator. |
String |
comparator |
A character expression that is used to compare against the baseString. |
Int32 |
startPos |
Specifies the 1-based starting position and continues to the left of the baseString. |
Returns
Type |
Description |
Boolean |
Returns true if a mismatch is found. |
RPG’s CHECKR. Verifies that each character in a base string or array is among the characters in the comparator string.
bool CheckCharactersReverse(string baseString, string comparator, int startPos, Array noMatchArray)
Parameters
Type |
Parameter name |
Description |
String |
baseString |
A character expression that contains the string to compare with comparator. |
String |
comparator |
A character expression that is used to compare against the baseString. |
Int32 |
startPos |
Specifies the 1-based starting position and continues to the left of the baseString. |
Array |
noMatchArray |
Returns the 1-based position of the first non-matched character in baseString that is not in the comparator. The first index in NoMatchArray is the rightmost mismatch in the baseString. |
Returns
Type |
Description |
Boolean |
Returns true if a mismatch is found. |
RPG’s %CHECK. Verifies that each character in the baseString is among the characters in the comparator.
int CheckPosition(string baseString, string comparator)
Parameters
Type |
Parameter name |
Description |
String |
baseString |
A character expression that contains the string to compare with comparator. |
String |
comparator |
A character expression that is used to compare against the baseString. |
Returns
Type |
Description |
Int32 |
Returns the 1 based position of the first non-matched character in baseString that is not in the comparator. |
RPG’s %CHECK. Verifies that each character in the baseString is among the characters in the comparator.
int CheckPosition(string baseString, string comparator, int startPos)
Parameters
Type |
Parameter name |
Description |
String |
baseString |
A character expression that contains the string to compare with comparator. |
String |
comparator |
A character expression that is used to compare against the baseString. |
Int32 |
startPos |
Default Position 1, not zero based. Specifies the start position from the left most position. |
Returns
Type |
Description |
Int32 |
Returns the 1 based position of the first non-matched character in baseString that is not in the comparator. |
RPG’s %CHECK. Verifies that each character in the baseString is among the characters in the comparator, starting from the right most position.
int CheckPositionReverse(string baseString, string comparator, int startPos)
Parameters
Type |
Parameter name |
Description |
String |
baseString |
A character expression that contains the string to compare with comparator. |
String |
comparator |
A character expression that is used to compare against the baseString. |
Int32 |
startPos |
Default Position end of string, not zero based. Specifies the start position from the left most position. |
Returns
Type |
Description |
Int32 |
Returns the 1 based position of the first non-matched character in baseString that is not in the comparator. |
RPG’s %CHECK. Verifies that each character in the baseString is among the characters in the comparator, starting from the right most position.
int CheckPositionReverse(string baseString, string comparator)
Parameters
Type |
Parameter name |
Description |
String |
baseString |
A character expression that contains the string to compare with comparator. |
String |
comparator |
A character expression that is used to compare against the baseString. |
Returns
Type |
Description |
Int32 |
Returns the 1 based position of the first non-matched character in baseString that is not in the comparator. |
Returns a (binary) decimal number based on its ‘memory’ representation.
decimal FromStringBinary(string num, int digits, int decimals)
Parameters
Type |
Parameter name |
Description |
String |
num |
The string representation of the number. |
Int32 |
digits |
The number of digits in the decimal number. |
Int32 |
decimals |
The number of decimal positions in the decimal number. |
Returns
Type |
Description |
Decimal |
The decimal number corresponding to the binary decimal representation. |
byte FromStringByte(string num)
Returns a byte based on its ‘memory’ representation.
byte FromStringByte(string num)
Parameters
Type |
Parameter name |
Description |
String |
num |
The string representation of the number. |
Returns
Type |
Description |
Byte |
The byte value corresponding to the first byte in the byte[] representation of the string. |
int FromStringInteger(string num)
Returns an integer number based on its ‘memory’ representation.
int FromStringInteger(string num)
Parameters
Type |
Parameter name |
Description |
String |
num |
The string representation of the number. |
Returns
Type |
Description |
Int32 |
The int value corresponding to the first 4 bytes in the byte[] representation of the string. |
long FromStringLong(string num)
Returns a long number based on its ‘memory’ representation.
long FromStringLong(string num)
Parameters
Type |
Parameter name |
Description |
String |
num |
The string representation of the number. |
Returns
Type |
Description |
Int64 |
The long value corresponding to the first 8 bytes in the byte[] representation of the string. |
Returns a (packed) decimal number based on its ‘memory’ representation.
decimal FromStringPacked(string num, int decimals)
Parameters
Type |
Parameter name |
Description |
String |
num |
The string representation of the number. |
Int32 |
decimals |
The number of decimal positions in the decimal number. |
Returns
Type |
Description |
Decimal |
The decimal number corresponding to the packed decimal representation. |
short FromStringShort(string num)
Returns a short number based on its ‘memory’ representation.
short FromStringShort(string num)
Parameters
Type |
Parameter name |
Description |
String |
num |
The string representation of the number. |
Returns
Type |
Description |
Int16 |
The short value corresponding to the first 2 bytes in the byte[] representation of the string. |
Returns a (zoned) decimal number based on its ‘memory’ representation.
decimal FromStringZoned(string num, int digits, int decimals)
Parameters
Type |
Parameter name |
Description |
String |
num |
The string representation of the number. |
Int32 |
digits |
The total number of digits the decimal has. |
Int32 |
decimals |
The number of decimal positions in the decimal number. |
Returns
Type |
Description |
Decimal |
The decimal number corresponding to the zoned decimal representation. |
Test a string to see if it is spaces.
bool IsBlanks(string arg)
Parameters
Type |
Parameter name |
Description |
String |
arg |
The string to test. |
Returns
Type |
Description |
Boolean |
True if the string characters are all blanks (space). False otherwise. |
RPG’s MOVEL. Moves left a numeric string to decimal, without pad.
decimal MoveLeft(string charStr, decimal targetOperand, int targetOperandDig, int targetOperandDec)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
string representing a decimal number. |
Decimal |
targetOperand |
decimal number of the targetOperand number. |
Int32 |
targetOperandDig |
number of digits in targetOperand. |
Int32 |
targetOperandDec |
number of decimals in targetOperand. |
Returns
Type |
Description |
Decimal |
returns the value of the move. |
RPG’s MOVEL. Moves left a string to string, with or without pad.
string MoveLeft(string charStr, string targetOperand)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
any string. |
String |
targetOperand |
string targetOperand. |
Returns
Type |
Description |
String |
returns the value of the move. |
RPG’s MOVEL. Moves left a string expressed in the given format into a date time type.
DateTime MoveLeft(string charStr, DateTime dateTime, DateTimeDataKind dateTimeKind, DateTimeFormat dateTimeFormat, DateTimeSeparator dateTimeSeparator)
Parameters
Returns
Type |
Description |
DateTime |
returns the value of the move. |
RPG’s MOVEL. Moves left a numeric string into an int2 (short).
short MoveLeft(string charStr, short targetOperand)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
Source numeric string. |
Int16 |
targetOperand |
Short value of the target. |
Returns
Type |
Description |
Int16 |
returns the value of the move. |
RPG’s MOVEL. Moves left a numeric string into an int4 (int).
int MoveLeft(string charStr, int targetOperand)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
Source numeric string. |
Int32 |
targetOperand |
Int value of the target. |
Returns
Type |
Description |
Int32 |
returns the value of the move. |
RPG’s MOVEL. Moves left a numeric string into an int8 (long).
long MoveLeft(string charStr, long targetOperand)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
Source numeric string. |
Int64 |
targetOperand |
Long value of the target. |
Returns
Type |
Description |
Int64 |
returns the value of the move. |
RPG’s MOVE. Moves left a string into a character.
char MoveLeftToChar(string charStr)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
A string the represents the source of the move. |
Returns
Type |
Description |
Char |
returns the value of the move. |
RPG’s MOVEL. Moves left a numeric string to decimal, with pad.
decimal MoveLeftWithPad(string charStr, decimal targetOperand, int targetOperandDig, int targetOperandDec)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
string representing a decimal number. |
Decimal |
targetOperand |
decimal number of the targetOperand number. |
Int32 |
targetOperandDig |
number of digits in targetOperand. |
Int32 |
targetOperandDec |
number of decimals in targetOperand. |
Returns
Type |
Description |
Decimal |
returns the value of the move. |
RPG’s MOVEL. Moves left a string to string, with pad.
string MoveLeftWithPad(string charStr, string targetOperand)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
any string. |
String |
targetOperand |
string targetOperand. |
Returns
Type |
Description |
String |
returns the value of the move. |
RPG’s MOVEL. Moves left a numeric string into an int2 (short) with pad.
short MoveLeftWithPad(string charStr, short targetOperand)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
Source numeric string. |
Int16 |
targetOperand |
Short value of the target. |
Returns
Type |
Description |
Int16 |
returns the value of the move. |
RPG’s MOVEL. Moves left a numeric string into an int4 (int) with pad.
int MoveLeftWithPad(string charStr, int targetOperand)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
Source numeric string. |
Int32 |
targetOperand |
Int value of the target. |
Returns
Type |
Description |
Int32 |
returns the value of the move. |
RPG’s MOVEL. Moves right a numeric string into an int8 (long) with pad.
long MoveLeftWithPad(string charStr, long targetOperand)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
Source numeric string. |
Int64 |
targetOperand |
Long value of the target. |
Returns
Type |
Description |
Int64 |
returns the value of the move. |
RPG’s MOVE. Moves right a numeric string to decimal, without pad.
decimal MoveRight(string charStr, decimal targetOperand, int targetOperandDig, int targetOperandDec)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
string representing a decimal number. |
Decimal |
targetOperand |
decimal number of the targetOperand number. |
Int32 |
targetOperandDig |
number of digits in targetOperand. |
Int32 |
targetOperandDec |
number of decimals in targetOperand. |
Returns
Type |
Description |
Decimal |
returns the value of the move. |
RPG’s MOVE. Moves right a string to string, without pad.
string MoveRight(string charStr, string targetOperand)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
any string. |
String |
targetOperand |
string targetOperand. |
Returns
Type |
Description |
String |
returns the value of the move. |
RPG’s MOVE. Moves right a string expressed in the given format into a date time type.
DateTime MoveRight(string charStr, DateTime dateTime, DateTimeDataKind dateTimeKind, DateTimeFormat dateTimeFormat, DateTimeSeparator dateTimeSeparator)
Parameters
Returns
Type |
Description |
DateTime |
returns the value of the move. |
RPG’s MOVE. Moves right a numeric string into an int2 (short).
short MoveRight(string charStr, short targetOperand)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
Source numeric string. |
Int16 |
targetOperand |
Short value of the target. |
Returns
Type |
Description |
Int16 |
returns the value of the move. |
RPG’s MOVE. Moves right a numeric string into an int4 (int).
int MoveRight(string charStr, int targetOperand)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
Source numeric string. |
Int32 |
targetOperand |
Int value of the target. |
Returns
Type |
Description |
Int32 |
returns the value of the move. |
RPG’s MOVE. Moves right a numeric string into an int8 (long).
long MoveRight(string charStr, long targetOperand)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
Source numeric string. |
Int64 |
targetOperand |
Long value of the target. |
Returns
Type |
Description |
Int64 |
returns the value of the move. |
RPG’s MOVE. Moves right a string into a character.
char MoveRightToChar(string charStr)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
A string the represents the source of the move. |
Returns
Type |
Description |
Char |
returns the value of the move. |
RPG’s MOVE. Moves right a numeric string to decimal, with pad.
decimal MoveRightWithPad(string charStr, decimal targetOperand, int targetOperandDig, int targetOperandDec)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
string representing a decimal number. |
Decimal |
targetOperand |
decimal number of the targetOperand number. |
Int32 |
targetOperandDig |
number of digits in targetOperand. |
Int32 |
targetOperandDec |
number of decimals in targetOperand. |
Returns
Type |
Description |
Decimal |
returns the value of the move. |
RPG’s MOVE. Moves right a string to string, with pad.
string MoveRightWithPad(string charStr, string targetOperand)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
any string. |
String |
targetOperand |
string targetOperand. |
Returns
Type |
Description |
String |
returns the value of the move. |
RPG’s MOVE. Moves right a numeric string into an int2 (short) with pad.
short MoveRightWithPad(string charStr, short targetOperand)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
Source numeric string. |
Int16 |
targetOperand |
Short value of the target. |
Returns
Type |
Description |
Int16 |
returns the value of the move. |
RPG’s MOVE. Moves right a numeric string into an int4 (int) with pad.
int MoveRightWithPad(string charStr, int targetOperand)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
Source numeric string. |
Int32 |
targetOperand |
Int value of the target. |
Returns
Type |
Description |
Int32 |
returns the value of the move. |
RPG’s MOVE. Moves right a numeric string into an int8 (long) with pad.
long MoveRightWithPad(string charStr, long targetOperand)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
Source numeric string. |
Int64 |
targetOperand |
Long value of the target. |
Returns
Type |
Description |
Int64 |
returns the value of the move. |
Moves a source string into an array.
void MoveToArray(string source, Array target, int startPosition)
Parameters
Type |
Parameter name |
Description |
String |
source |
The FixedString value to move. |
Array |
target |
The array that will receive values from source. |
Int32 |
startPosition |
The array element where the copy starts. |
Moves a source string into an array.
void MoveToArrayWithPad(string source, Array target, int startPosition)
Parameters
Type |
Parameter name |
Description |
String |
source |
The FixedString value to move. |
Array |
target |
The array that will receive values from source. |
Int32 |
startPosition |
The array element where the copy starts. |
RPG’s %SUBST. Replaces characters in a string based on position and length.
string Replace(string target, string from, int startPos, int length, bool isRightAdg)
Parameters
Type |
Parameter name |
Description |
String |
target |
The string where replacements will occur. |
String |
from |
The replace string. |
Int32 |
startPos |
Starting position in target. |
Int32 |
length |
Length of replacement. |
Boolean |
isRightAdg |
true for right adjust, false for left adjust (default). |
Returns
Type |
Description |
String |
The string after the replacement. |
RPG’s %SUBST. Replaces characters in a string based on position and length.
string Replace(string target, string from, int startPos, bool isRightAdg)
Parameters
Type |
Parameter name |
Description |
String |
target |
The string where replacements will occur. |
String |
from |
The replace string. |
Int32 |
startPos |
Starting position in target. |
Boolean |
isRightAdg |
true for right adjust, false for left adjust (default). |
Returns
Type |
Description |
String |
The string after the replacement. |
RPG’s %SUBST. Replaces characters in a string based on position and length.
string Replace(string target, string from, int startPos, int length)
Parameters
Type |
Parameter name |
Description |
String |
target |
The string where replacements will occur.. |
String |
from |
The replace string. |
Int32 |
startPos |
Starting position in target. |
Int32 |
length |
Length to replace, pass -1 to use the length of the replacement string. |
Returns
Type |
Description |
String |
The string after the replacement. |
RPG’s %SUBST. Replaces characters in a string based on position and length.
string ReplaceFixed(string target, int baseLength, string from, int startPos, int length)
Parameters
Type |
Parameter name |
Description |
String |
target |
The string where replacements will occur.. |
Int32 |
baseLength |
The length of the resulting string. |
String |
from |
The replace string. |
Int32 |
startPos |
Starting position in target. |
Int32 |
length |
Length to replace, pass -1 to use the length of the replacement string. |
Returns
Type |
Description |
String |
The string after the replacement. |
RPG’s %SCAN. Returns the first position of the search argument in the source string, or 0 if it was not found.
int ScanString(string baseString, string CmpStr, int startPos)
Parameters
Type |
Parameter name |
Description |
String |
baseString |
A character expression that contains the string that scan will search. |
String |
CmpStr |
A character expression scan will use to search the baseString. |
Int32 |
startPos |
The 1 based start position in baseString. |
Returns
Type |
Description |
Int32 |
Returns the 1 based starting position of a match relative to the baseString. |
RPG’s %SCAN. Returns the first position of the search argument in the source string, or 0 if it was not found.
int ScanString(string baseString, string CmpStr)
Parameters
Type |
Parameter name |
Description |
String |
baseString |
A character expression that contains the string that scan will search. |
String |
CmpStr |
A character expression scan will use to search the baseString. |
Returns
Type |
Description |
Int32 |
Returns the 1 based starting position of a match relative to the baseString. |
RPG’s SCAN. Attempts to find cmpStr in the baseString.
bool ScanString(string baseString, string cmpStr, int cmpLen, int startPos)
Parameters
Type |
Parameter name |
Description |
String |
baseString |
A character expression that contains the string to compare with cmpStr. |
String |
cmpStr |
A character expression that baseString is scanned for. |
Int32 |
cmpLen |
Default value is the length of cmpStr. Specifies the length of cmpStr that is scanned for in baseString. |
Int32 |
startPos |
The 1 based start position in baseString. |
Returns
Type |
Description |
Boolean |
Returns true if cmpStr is found in baseString. |
RPG’s SCAN. Attempts to find cmpStr in the baseString.
bool ScanString(string baseString, string cmpStr, int cmpLen, int startPos, Array fndPosArray)
Parameters
Type |
Parameter name |
Description |
String |
baseString |
A character expression that contains the string to compare with cmpStr. |
String |
cmpStr |
A character expression that baseString is scanned for. |
Int32 |
cmpLen |
Default value is the length of cmpStr. Specifies the length of cmpStr that is scanned for in baseString. |
Int32 |
startPos |
The 1 based start position in baseString. |
Array |
fndPosArray |
The array on which to store all the positions in baseString where cmpStr starts. |
Returns
Type |
Description |
Boolean |
Returns true if cmpStr is found in baseString. |
Sets the flags according to the value of testString.
string SetHiLoEq(string testString, Indicator& hi, Indicator& lo, Indicator& eq)
Parameters
Type |
Parameter name |
Description |
String |
testString |
The string to test. |
Indicator& |
hi |
Will be set to ‘0’. |
Indicator& |
lo |
Will be set to ‘0’. |
Indicator& |
eq |
Will be ‘1’ if testString is all blanks, otherwise ‘0’. |
Returns
Type |
Description |
String |
The test value. |
Sets the variable length string to the indicated length, ensuring that it is no longer than limit.
string SetVaryingLength(string charStr, int length, int limit)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
A variable length string. |
Int32 |
length |
The desired length. |
Int32 |
limit |
The maximum allowed length. |
Returns
Type |
Description |
String |
The string value at the desired length, at most equal to limit. |
RPG’s SUBST. Returns a substring from baseString, starting at startPos ending at subLen, puts it into target, no padding, no preservation of length.
string SubStr(string baseString, int startPos, int subLen)
Parameters
Type |
Parameter name |
Description |
String |
baseString |
A character expression that contains the string SubStr will operate on. |
Int32 |
startPos |
The 1 based start position for baseString. |
Int32 |
subLen |
The length of the substring. |
Returns
Type |
Description |
String |
The string value resulting from the operation. |
RPG’s SUBST. Returns a substring from baseString, starting at startPos ending at subLen, puts it into target. This function preserves the length of the target, no padding.
string SubStrFixed(string baseString, int startPos, int subLen, string target)
Parameters
Type |
Parameter name |
Description |
String |
baseString |
A character expression that contains the string SubStr will operate on. |
Int32 |
startPos |
The 1 based start position for baseString. |
Int32 |
subLen |
The length of the substring. |
String |
target |
Target Operand of the substring. |
Returns
Type |
Description |
String |
The string value resulting from the operation. |
RPG’s SUBST. Returns a substring from baseString, starting at startPos ending at subLen, puts it into target. This function preserves the length of the target, and pads the result.
string SubStrFixedWithPad(string baseString, int startPos, int subLen, string target)
Parameters
Type |
Parameter name |
Description |
String |
baseString |
A character expression that contains the string SubStr will operate on. |
Int32 |
startPos |
The 1 based start position for baseString. |
Int32 |
subLen |
The length of the substring. |
String |
target |
Target Operand of the substring. |
Returns
Type |
Description |
String |
The string value resulting from the operation. |
Converts a numeric string into a byte number.
byte ToByte(string charStr)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
string representing a byte number. |
Returns
Type |
Description |
Byte |
byte representation of given string. |
Converts a string representation of a date/time/timestamp into a DateTime.
DateTime ToDateTime(string charStr, DateTimeDataKind dateTimeKind, DateTimeFormat dateTimeFormat, DateTimeSeparator dateTimeSeparator)
Parameters
Returns
Type |
Description |
DateTime |
The DateTime value parsed from charStr. |
Converts a numeric string into a double number.
double ToDouble(string charStr)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
string representing a double number. |
Returns
Type |
Description |
Double |
double representation of given string. |
Converts a numeric string into a RPG decimal.
decimal ToFixedDecimal(string charStr, int digits, int decimals)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
string representing a decimal number. |
Int32 |
digits |
number of digits in the targetOperand. |
Int32 |
decimals |
number of decimals in the targetOperand. |
Returns
Type |
Description |
Decimal |
decimal representation of given string. |
Converts a numeric string into a RPG decimal with rounding (half adjust).
decimal ToFixedDecimalRounded(string charStr, int digits, int decimals)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
string representing a decimal number. |
Int32 |
digits |
number of digits in the targetOperand. |
Int32 |
decimals |
number of decimals in the targetOperand. |
Returns
Type |
Description |
Decimal |
decimal representation of given string. |
Converts a numeric string into a float number.
float ToFloat(string charStr)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
string representing a float number. |
Returns
Type |
Description |
Single |
float representation of given string. |
Converts a numeric string into a short number.
short ToInt16(string charStr)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
string representing a short number. |
Returns
Type |
Description |
Int16 |
short representation of given string. |
Converts a numeric string into an int number.
int ToInt32(string charStr)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
string representing an int number. |
Returns
Type |
Description |
Int32 |
int representation of given string. |
Converts a numeric string into a long number.
long ToInt64(string charStr)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
string representing a long number. |
Returns
Type |
Description |
Int64 |
long representation of given string. |
Converts a string representing a packed number into a RPG decimal.
decimal ToPackedDecimal(string charStr, int decimals)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
string representing a packed decimal number. |
Int32 |
decimals |
number of decimal positions in the targetOperand. |
Returns
Type |
Description |
Decimal |
decimal packed representation of given string. |
Converts a zoned representation string into a RPG decimal.
decimal ToZonedDecimal(string charStr, int digits, int decimals)
Parameters
Type |
Parameter name |
Description |
String |
charStr |
string representing a zoned decimal number. |
Int32 |
digits |
number of digits in the targetOperand. |
Int32 |
decimals |
number of decimals in the targetOperand. |
Returns
Type |
Description |
Decimal |
decimal representation of given string. |
RPG’s %Xlate. Translates baseString according to the values of mapFrom, mapTo, and startPos.
string Xlate(string baseString, string mapFrom, string mapTo, int startPos)
Parameters
Type |
Parameter name |
Description |
String |
baseString |
The string to be translated. |
String |
mapFrom |
A string containing a list of characters that should be replaced. |
String |
mapTo |
A string containing a list of characters with replacement values. |
Int32 |
startPos |
The 1-based position in the baseString where replacement starts. Defaults to 1. |
Returns
Type |
Description |
String |
The string resulting after the Xlate operation. |
RPG’s XLATE. Translates characters in the baseString according to MapFrom, MapTo, startPos and targetString, no padding, no preservation of length.
string Xlate(string baseString, string mapFrom, string mapTo, string targetString, int startPos)
Parameters
Type |
Parameter name |
Description |
String |
baseString |
A character expression that contains the string Xlate will operate on. |
String |
mapFrom |
From string, if characters are duplicated the first occurrence is used. |
String |
mapTo |
To string, describes what the characters in mapFrom will become. |
String |
targetString |
Target operand of the Xlate operation. |
Int32 |
startPos |
The 1 based start position for baseString. |
Returns
Type |
Description |
String |
The string value of the result of the Xlate. |
RPG’s XLATE. Translates characters in the baseString according to MapFrom, MapTo, startPos and targetString. This version preserves the length of the result, does NOT pad.
string XlateFixed(string baseString, string mapFrom, string mapTo, string targetString, int startPos)
Parameters
Type |
Parameter name |
Description |
String |
baseString |
A character expression that contains the string Xlate will operate on. |
String |
mapFrom |
From string, if characters are duplicated the first occurrence is used. |
String |
mapTo |
To string, describes what the characters in mapFrom will become. |
String |
targetString |
Target operand of the Xlate operation. |
Int32 |
startPos |
The 1 based start position for baseString. |
Returns
Type |
Description |
String |
The string value of the result of the Xlate. |
RPG’s XLATE. Translates characters in the baseString according to MapFrom, MapTo, startPos and targetString. This version preserves the length of the result, with padding.
string XlateFixedWithPad(string baseString, string mapFrom, string mapTo, string targetString, int startPos)
Parameters
Type |
Parameter name |
Description |
String |
baseString |
A character expression that contains the string Xlate will operate on. |
String |
mapFrom |
From string, if characters are duplicated the first occurrence is used. |
String |
mapTo |
To string, describes what the characters in mapFrom will become. |
String |
targetString |
Target operand of the Xlate operation. |
Int32 |
startPos |
The 1 based start position for baseString. |
Returns
Type |
Description |
String |
The string value of the result of the Xlate. |