StringOps class | QSYS API Reference Guide
Estimated reading time: 11 minutes
Provide fixed length character string storage and operations.
Namespace: ASNA.QSys.Runtime
Assembly: ASNA.QSys.Runtime.dll
Inheritance: Object
Methods
Signature |
Description |
Adjust(String, Int32, Boolean) |
Adjust the length of a string to a given value, by padding or truncating the string. |
AdjustLeftLength(String, Int32) |
Adjust the length of a string to a given value, by padding or truncating the string on the left. |
AdjustRightLength(String, Int32) |
Adjust the length of a string to a given value, by padding or truncating the string on the right. |
GetArrayChars(Array, Char[], Int32, Int32) |
Copy characters from strings stored in an array to a char[]. |
GetArrayOneChars(Array, Char[], Int32) |
Copy characters from an array to a one-dimensional array. |
GetChars(String, Char[], Int32, Int32) |
Copy characters from a string to an array of char. |
GetIndices(Array, Int32) |
Get the indices of a multidimensional array for the given position. |
MergeLeftString(String, String) |
RPG’s MoveLeft. Merge the sourceValue into targetValue starting at position 0. |
MergeRightString(String, String) |
RPG’s Move(Right). Merge the sourceValue into targetValue starting at the end of targetValue. |
SetArrayChars(Array, Char[], Int32, Int32) |
Load an array of strings with the strings constructed out of a char[]. |
SetArrayOneChars(Array, Char[], Int32) |
Copy characters from a one-dimensional array to an array. |
SetChars(String, Char[], Int32, Int32) |
Create a string out of character in a char[]. |
SetLengthOfField(String, Int32&) |
Sets the length parameter to the length of the string. Throws an exception if the string is null. |
SetVaryingLengthChar(String, Int32, Int32&) |
Keep a string with at most maxLength characters, and compute its current length. |
TestNumeric(String) |
Test a string for any of the conditions specified in the TestNumericResult enumeration. |
VaryLength(Int32, String, Int32, Int32&) |
Set the length of source to the given length subject to maxLength, and return the newLength. |
Adjust the length of a string to a given value, by padding or truncating the string.
string Adjust(string source, int targetLength, bool padLeft)
Parameters
Type |
Parameter name |
Description |
String |
source |
The string to adjust. |
Int32 |
targetLength |
The desired length. |
Boolean |
padLeft |
True to pad/truncate on the left, false to pad/truncate on the right. |
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 AdjustLeftLength(string source, int targetLength)
Parameters
Type |
Parameter name |
Description |
String |
source |
The string to adjust. |
Int32 |
targetLength |
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 right.
string AdjustRightLength(string source, int targetLength)
Parameters
Type |
Parameter name |
Description |
String |
source |
The string to adjust. |
Int32 |
targetLength |
The desired length. |
Returns
Type |
Description |
String |
The string at the desired length. |
Copy characters from strings stored in an array to a char[].
void GetArrayChars(Array array, Char[] target, int targetIndex, int charLength)
Parameters
Type |
Parameter name |
Description |
Array |
array |
The source of the operation. |
Char[] |
target |
The target char[]. |
Int32 |
targetIndex |
Position in target where the copying should start. |
Int32 |
charLength |
Length of the strings in the source array. |
Copy characters from an array to a one-dimensional array.
void GetArrayOneChars(Array array, Char[] target, int targetIndex)
Parameters
Type |
Parameter name |
Description |
Array |
array |
The source of the operation. |
Char[] |
target |
The target char[]. |
Int32 |
targetIndex |
Position in target where the copying should start. |
Copy characters from a string to an array of char.
void GetChars(string source, Char[] destination, int destinationIndex, int destinationLength)
Parameters
Type |
Parameter name |
Description |
String |
source |
The string. |
Char[] |
destination |
The char[] into which to copy source. |
Int32 |
destinationIndex |
The starting position on the destination array. |
Int32 |
destinationLength |
How many characters to copy. |
Get the indices of a multidimensional array for the given position.
Int32[] GetIndices(Array myArr, int i)
Parameters
Type |
Parameter name |
Description |
Array |
myArr |
The multidimensional array. |
Int32 |
i |
The position of the element. |
Returns
Type |
Description |
Int32[] |
An in[] with the indices of the i-th element. |
RPG’s MoveLeft. Merge the sourceValue into targetValue starting at position 0.
string MergeLeftString(string sourceValue, string targetValue)
Parameters
Type |
Parameter name |
Description |
String |
sourceValue |
Source value. |
String |
targetValue |
Target value. |
Returns
Type |
Description |
String |
The result of the merge. |
RPG’s Move(Right). Merge the sourceValue into targetValue starting at the end of targetValue.
string MergeRightString(string sourceValue, string targetValue)
Parameters
Type |
Parameter name |
Description |
String |
sourceValue |
Source value. |
String |
targetValue |
Target value. |
Returns
Type |
Description |
String |
The result of the merge. |
Load an array of strings with the strings constructed out of a char[].
void SetArrayChars(Array array, Char[] source, int sourceIndex, int charLength)
Parameters
Type |
Parameter name |
Description |
Array |
array |
Array of strings to load. |
Char[] |
source |
The char[] that’s the source of the strings. |
Int32 |
sourceIndex |
Position in source where to start constructing strings. |
Int32 |
charLength |
Length of the individual strings to be constructed. |
Copy characters from a one-dimensional array to an array.
void SetArrayOneChars(Array array, Char[] source, int sourceIndex)
Parameters
Type |
Parameter name |
Description |
Array |
array |
The destination of the copy. |
Char[] |
source |
The source char[]. |
Int32 |
sourceIndex |
Position in source where to start copying chars. |
Create a string out of character in a char[].
string SetChars(string destination, Char[] source, int sourceIndex, int sourceLength)
Parameters
Type |
Parameter name |
Description |
String |
destination |
String that serves as model for the created string. |
Char[] |
source |
The char[]. |
Int32 |
sourceIndex |
The starting position in the array. |
Int32 |
sourceLength |
The length of the array. |
Returns
Type |
Description |
String |
The string created with characters from the array. |
Sets the length parameter to the length of the string. Throws an exception if the string is null.
void SetLengthOfField(string source, Int32& length)
Parameters
Type |
Parameter name |
Description |
String |
source |
The string. |
Int32& |
length |
The resulting value of the length of the string. |
Keep a string with at most maxLength characters, and compute its current length.
string SetVaryingLengthChar(string source, int maxLength, Int32& length)
Parameters
Type |
Parameter name |
Description |
String |
source |
The string to analyze. |
Int32 |
maxLength |
The maximum allowed length for source. |
Int32& |
length |
The resulting length of source. |
Returns
Type |
Description |
String |
The value of source adjusted to maxLength if needed. |
Test a string for any of the conditions specified in the TestNumericResult enumeration.
TestNumericResult TestNumeric(string candidate)
Parameters
Type |
Parameter name |
Description |
String |
candidate |
The string to test. |
Returns
Type |
Description |
TestNumericResult |
A TestNumericResult value specifying the status of the string. |
Set the length of source to the given length subject to maxLength, and return the newLength.
string VaryLength(int length, string source, int maxLength, Int32& newLength)
Parameters
Type |
Parameter name |
Description |
Int32 |
length |
Desired length of source. |
String |
source |
The string to adjust in length. |
Int32 |
maxLength |
The maximum allowed length. |
Int32& |
newLength |
The resulting length. |
Returns
Type |
Description |
String |
The value of source adjusted to the given length. |