FixedStringMethods class | QSYS API Reference Guide
Estimated reading time: 24 minutes
Contains extension methods for handling RPG operations for FixedString values.
Namespace: ASNA.QSys.Runtime
Assembly: ASNA.QSys.Runtime.dll
Inheritance: Object
Methods
Signature |
Description |
AdjustEnd<T>(FixedString<T>, Int32) |
Adjusts the length of a string, padding on the right if necessary. |
AdjustStart<T>(FixedString<T>, Int32) |
Adjusts the length of a string, padding on the left if necessary. |
FromStringBinary<T>(FixedString<T>, Int32, Int32) |
Returns a decimal number based on its binary ‘memory’ representation. |
FromStringPacked<T>(FixedString<T>, Int32) |
Returns a decimal number based on its packed ‘memory’ representation. |
FromStringZoned<T>(FixedString<T>, Int32, Int32) |
Returns a decimal number based on its zoned ‘memory’ representation. |
IsBlanks<T>(FixedString<T>) |
Tests a string to see if it is all blanks (‘ ‘). |
MoveLeft<T>(FixedString<T>, IFixedDateTime) |
RPG’s MOVEL. Moves left a string expressed in the given format into a date/time type. |
MoveLeft<T>(FixedString<T>, Int16) |
RPG’s MOVEL. Moves left a numeric string into an int2 (short). |
MoveLeft<T>(FixedString<T>, Int16) |
RPG’s MOVEL. Moves left a numeric string into an int4 (int). |
MoveLeft<T>(FixedString<T>, Int16) |
RPG’s MOVEL. Moves left a numeric string into an int8 (long). |
MoveLeftToChar<T>(FixedString<T>) |
RPG’s MOVE. Moves left a string into a character. |
MoveLeftWithPad<T>(FixedString<T>, Int16) |
RPG’s MOVEL. Moves left a numeric string into an int2 (short) with pad. |
MoveLeftWithPad<T>(FixedString<T>, Int16) |
RPG’s MOVEL. Moves left a numeric string into an int4 (int) with pad. |
MoveLeftWithPad<T>(FixedString<T>, Int16) |
RPG’s MOVEL. Moves right a numeric string into an int8 (long) with pad. |
MoveRight<T>(FixedString<T>, IFixedDateTime) |
RPG’s MOVE. Moves right a string expressed in the given format into a date/time type. |
MoveRight<T>(FixedString<T>, Int16) |
RPG’s MOVE. Moves right a numeric string into an int2 (short). |
MoveRight<T>(FixedString<T>, Int16) |
RPG’s MOVE. Moves right a numeric string into an int4 (int). |
MoveRight<T>(FixedString<T>, Int16) |
RPG’s MOVE. Moves right a numeric string into an int8 (long). |
MoveRightToChar<T>(FixedString<T>) |
RPG’s MOVE. Moves right a string into a character. |
MoveRightWithPad<T>(FixedString<T>, Int16) |
RPG’s MOVE. Moves right a numeric string into an int2 (short) with pad. |
MoveRightWithPad<T>(FixedString<T>, Int16) |
RPG’s MOVE. Moves right a numeric string into an int4 (int) with pad. |
MoveRightWithPad<T>(FixedString<T>, Int16) |
RPG’s MOVE. Moves right a numeric string into an int8 (long) with pad. |
ReplaceFixed<T>(FixedString<T>, Int32, String, Int32, Int32) |
RPG’s %REPLACE. Replaces a length of characters in a FixedString value with a replacement string. |
SetHiLoEq<T>(FixedString<T>, Indicator&, Indicator&, Indicator&) |
Sets the flags according to the value of testString. |
SubStr<T>(FixedString<T>, 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. |
SubStr<T>(FixedString<T>, Int32, Int32, Indicator&) |
RPG’s SUBST. Returns a substring from baseString, starting at startPos ending at subLen, puts it into target, no padding, no preservation of length. |
ToDateTime<T>(FixedString<T>, IFixedDateTime) |
Converts a string representation of a date/time/timestamp into a DateTime. |
ToDateTime<T>(FixedString<T>, DateTimeDataKind, DateTimeFormat, DateTimeSeparator) |
Converts a string representation of a date/time/timestamp into a DateTime. |
ToFixedDecimal<T>(FixedString<T>, Int32, Int32) |
Converts a numeric string into a RPG decimal. |
ToFixedDecimalRounded<T>(FixedString<T>, Int32, Int32) |
Converts a numeric string into a RPG decimal with rounding (half adjust). |
ToPackedDecimal<T>(FixedString<T>, Int32) |
Converts a string representing a packed decimal into a decimal number. |
ToZonedDecimal<T>(FixedString<T>, Int32, Int32) |
Converts a string representing a zoned decimal into a decimal number. |
TrimEnd<T>(FixedString<T>) |
Removes all the trailing white-space characters from the current string. |
TrimStart<T>(FixedString<T>) |
Removes all the leading white-space characters from the current string. |
Adjusts the length of a string, padding on the right if necessary.
string AdjustEnd<T>(FixedString<T> charStr, int length)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
charStr |
The string to adjust. |
Int32 |
length |
The desired length. |
Returns
Type |
Description |
String |
The string at the desired length, after trimming or padding on the right. |
Adjusts the length of a string, padding on the left if necessary.
string AdjustStart<T>(FixedString<T> charStr, int length)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
charStr |
The string to adjust. |
Int32 |
length |
The desired length. |
Returns
Type |
Description |
String |
The string at the desired length, after trimming or padding on the left. |
Returns a decimal number based on its binary ‘memory’ representation.
decimal FromStringBinary<T>(FixedString<T> num, int digits, int decimals)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
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. |
Returns a decimal number based on its packed ‘memory’ representation.
decimal FromStringPacked<T>(FixedString<T> num, int decimals)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
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. |
Returns a decimal number based on its zoned ‘memory’ representation.
decimal FromStringZoned<T>(FixedString<T> num, int digits, int decimals)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
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. |
Tests a string to see if it is all blanks (‘ ‘).
bool IsBlanks<T>(FixedString<T> arg)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
arg |
The fixed string to test. |
Returns
Type |
Description |
Boolean |
True if the string contains blanks. |
RPG’s MOVEL. Moves left a string expressed in the given format into a date/time type.
DateTime MoveLeft<T>(FixedString<T> charStr, IFixedDateTime dateTime)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
charStr |
Source FixedString. |
IFixedDateTime |
dateTime |
Destination FixedDate, FixedTime, or FixedTimestamp. |
Returns
Type |
Description |
DateTime |
The value that results after the Move operation, as a DateTime value. |
RPG’s MOVEL. Moves left a numeric string into an int2 (short).
short MoveLeft<T>(FixedString<T> charStr, short target)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
charStr |
Source numeric string. |
Int16 |
target |
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).
short MoveLeft<T>(FixedString<T> charStr, short target)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
charStr |
Source numeric string. |
Int16 |
target |
Int value of the target. |
Returns
Type |
Description |
Int16 |
returns the value of the move. |
RPG’s MOVEL. Moves left a numeric string into an int8 (long).
short MoveLeft<T>(FixedString<T> charStr, short target)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
charStr |
Source numeric string. |
Int16 |
target |
Long value of the target. |
Returns
Type |
Description |
Int16 |
returns the value of the move. |
RPG’s MOVE. Moves left a string into a character.
char MoveLeftToChar<T>(FixedString<T> charStr)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
charStr |
A string the represents the source of the move. |
Returns
Type |
Description |
Char |
The leftmost character of charStr. |
RPG’s MOVEL. Moves left a numeric string into an int2 (short) with pad.
short MoveLeftWithPad<T>(FixedString<T> charStr, short target)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
charStr |
Source numeric string. |
Int16 |
target |
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.
short MoveLeftWithPad<T>(FixedString<T> charStr, short target)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
charStr |
Source numeric string. |
Int16 |
target |
Int value of the target. |
Returns
Type |
Description |
Int16 |
returns the value of the move. |
RPG’s MOVEL. Moves right a numeric string into an int8 (long) with pad.
short MoveLeftWithPad<T>(FixedString<T> charStr, short target)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
charStr |
Source numeric string. |
Int16 |
target |
Long value of the target. |
Returns
Type |
Description |
Int16 |
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<T>(FixedString<T> charStr, IFixedDateTime dateTime)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
charStr |
Source FixedString. |
IFixedDateTime |
dateTime |
Destination FixedDate, FixedTime, or FixedTimestamp. |
Returns
Type |
Description |
DateTime |
The value that results after the Move operation, as a DateTime value. |
RPG’s MOVE. Moves right a numeric string into an int2 (short).
short MoveRight<T>(FixedString<T> charStr, short target)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
charStr |
Source numeric string. |
Int16 |
target |
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).
short MoveRight<T>(FixedString<T> charStr, short target)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
charStr |
Source numeric string. |
Int16 |
target |
Int value of the target. |
Returns
Type |
Description |
Int16 |
returns the value of the move. |
RPG’s MOVE. Moves right a numeric string into an int8 (long).
short MoveRight<T>(FixedString<T> charStr, short target)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
charStr |
Source numeric string. |
Int16 |
target |
Long value of the target. |
Returns
Type |
Description |
Int16 |
returns the value of the move. |
RPG’s MOVE. Moves right a string into a character.
char MoveRightToChar<T>(FixedString<T> charStr)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
charStr |
A string the represents the source of the move. |
Returns
Type |
Description |
Char |
The rightmost character of charStr. |
RPG’s MOVE. Moves right a numeric string into an int2 (short) with pad.
short MoveRightWithPad<T>(FixedString<T> charStr, short target)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
charStr |
Source numeric string. |
Int16 |
target |
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.
short MoveRightWithPad<T>(FixedString<T> charStr, short target)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
charStr |
Source numeric string. |
Int16 |
target |
Int value of the target. |
Returns
Type |
Description |
Int16 |
returns the value of the move. |
RPG’s MOVE. Moves right a numeric string into an int8 (long) with pad.
short MoveRightWithPad<T>(FixedString<T> charStr, short target)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
charStr |
Source numeric string. |
Int16 |
target |
Long value of the target. |
Returns
Type |
Description |
Int16 |
returns the value of the move. |
RPG’s %REPLACE. Replaces a length of characters in a FixedString value with a replacement string.
string ReplaceFixed<T>(FixedString<T> baseString, int baseLenConst, string repString, int startPos, int lengthToReplace)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
baseString |
Original FixedString value where replacement will occur. |
Int32 |
baseLenConst |
Length to adjust the resulting string to. |
String |
repString |
Replacement string. |
Int32 |
startPos |
Position in the original string where replacement will start. |
Int32 |
lengthToReplace |
Number of character in the original string to replace. |
Returns
Type |
Description |
String |
The string after the replacement and length adjustment. |
Sets the flags according to the value of testString.
string SetHiLoEq<T>(FixedString<T> testString, Indicator& hi, Indicator& lo, Indicator& eq)
Parameters
Returns
Type |
Description |
String |
A copy of testString. |
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<T>(FixedString<T> baseString, int startPos, int subLen)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
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, no padding, no preservation of length.
string SubStr<T>(FixedString<T> baseString, int startPos, int subLen, Indicator& errInd)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
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. |
Indicator& |
errInd |
Indicator will be set if a runtime error occurs. |
Returns
Type |
Description |
String |
The string value resulting from the operation. |
Converts a string representation of a date/time/timestamp into a DateTime.
DateTime ToDateTime<T>(FixedString<T> charStr, IFixedDateTime dateTime)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
charStr |
The FixedString value representing a date/time/timestamp. |
IFixedDateTime |
dateTime |
FixedDate, FixedTime, FixedTimestamp that determines the format. |
Returns
Type |
Description |
DateTime |
The DateTime value parsed from charStr. |
Converts a string representation of a date/time/timestamp into a DateTime.
DateTime ToDateTime<T>(FixedString<T> charStr, DateTimeDataKind dateTimeKind, DateTimeFormat dateTimeFormat, DateTimeSeparator dateTimeSeparator)
Parameters
Returns
Type |
Description |
DateTime |
The DateTime value parsed from charStr. |
Converts a numeric string into a RPG decimal.
decimal ToFixedDecimal<T>(FixedString<T> charStr, int digits, int decimals)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
charStr |
String representing a decimal number in the current culture. |
Int32 |
digits |
Number of digits in the target. |
Int32 |
decimals |
Number of decimals in the target. |
Returns
Type |
Description |
Decimal |
Decimal equivalent of the given string. |
Converts a numeric string into a RPG decimal with rounding (half adjust).
decimal ToFixedDecimalRounded<T>(FixedString<T> charStr, int digits, int decimals)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
charStr |
string representing a decimal number. |
Int32 |
digits |
number of digits in the target. |
Int32 |
decimals |
number of decimals in the target. |
Returns
Type |
Description |
Decimal |
decimal representation of given string. |
Converts a string representing a packed decimal into a decimal number.
decimal ToPackedDecimal<T>(FixedString<T> charStr, int decimals)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
charStr |
String representing a packed decimal. |
Int32 |
decimals |
Number of decimals in the target. |
Returns
Type |
Description |
Decimal |
Decimal equivalent of the given string. |
Converts a string representing a zoned decimal into a decimal number.
decimal ToZonedDecimal<T>(FixedString<T> charStr, int digits, int decimals)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
charStr |
String representing a zoned decimal. |
Int32 |
digits |
Number of digits in the target. |
Int32 |
decimals |
Number of decimals in the target. |
Returns
Type |
Description |
Decimal |
Decimal equivalent of the given string. |
Removes all the trailing white-space characters from the current string.
string TrimEnd<T>(FixedString<T> baseString)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
baseString |
The FixedString value to trim. |
Returns
Type |
Description |
String |
The string that remains after all white-space characters are removed from theend of the current string. If no characters can be trimmed from the current instance,the method returns the current instance unchanged. |
Removes all the leading white-space characters from the current string.
string TrimStart<T>(FixedString<T> baseString)
Parameters
Type |
Parameter name |
Description |
FixedString<T> |
baseString |
The FixedString value to trim. |
Returns
Type |
Description |
String |
The string that remains after all white-space characters are removed from thebegining of the current string. If no characters can be trimmed from the current instance,the method returns the current instance unchanged. |