BASICS1R3 (RPGLE)

Basic Routines : Strings
Details ....

Copybooks  

QBASICS1,PBASICS1R3
SrvPgm: Basic Routines - Strings cpybk
QBASICS1,PBASICS1R2
SrvPgm: Basic Routines - API Error Handling cpybk
QBASICS1,PBASICS1R4
SrvPgm: Basic Routines - Assert/This/Caller cpybk
QBASICS1,PBASICS1R7
SrvPgm: Basic Routines - Mathematics cpybk
QBASICS1,BASICS1R0
SrvPgm: Basic Routines - Declarations cpybk
QBASICS1,CLIB
Prototypes for C-Library (include)
QBASICS1,CEELIB
Prototypes for CEE APIs (include)

Procedures  

f_addQuotesexported
Add quotes
f_alignRexported
Right align
f_centerexported
Center
f_containsInvalidCharAtexported
Contains invalid character
f_containsStringAtexported
Contains string
f_cvtBufferToHexStringexported
Convert to hex
f_cvtHexStringToBufferexported
Convert from hex
f_ebcdicexported
f_editCodeexported
Edit code
f_editWordexported
Edit word
f_endsWithexported
Ends with
f_formatDateexported
Format date
f_formatMemSizeexported
Format memory size
f_genStrCmpexported
Compare strings
f_genStrCmpIgnCaseexported
Compare strings (case insensitive)
f_getLengthEditCodeexported
Get edit code formatted string length
f_getLengthEditWordexported
Get edit word formatted string length
f_lcaseexported
To lower case
f_leftexported
Get left string portion
f_objNameexported
Build object name
f_parseDateexported
Parse date
f_replaceexported
Replace all
f_rightexported
Get right string portion
f_rmvKeywordexported
Remove keyword
f_rmvQuotesexported
Remove quotes
f_rplUnPrtCharsexported
Replace unprintable characters
f_scanRexported
Last index of
f_spaceexported
Create empty string
f_startsWithexported
Starts with
f_ucaseexported
To upper case
f_valexported
Get numeric value
f_wordWrapexported
Word wrap
lf_cvtRpgVarTypeToEdtAPIVarClass
lf_wordWrap

Detailed Description  

Author:
Thomas Raddatz
Date:
08.10.2003
Links:
http://www.tools400.de

Procedure Documentation  

f_addQuotes  

Zeichenf_addQuotes(Zeichen, Zeichen)
Adds quotes to a given string.
Parameter:
Zeichen (4096)   const   varyingThe given string.
Zeichen (1)   const   optionalThe quote to be added to the string.
Return value:
Zeichen (4096)The string with quotes.
Exported.

f_alignR  

Zeichenf_alignR(Zeichen, ohne Vorzeichen)
Right aligns a string.
Parameter:
Zeichen (4096)   const   varyingThe string to be right aligned.
Numerisch (ohne Vorzeichen) (10)   const   optionalThe length of the target field.
Return value:
Zeichen (4096)The right aligned string.
Exported.

f_center  

Zeichenf_center(Zeichen, ohne Vorzeichen)
Centers a string.
Parameter:
Zeichen (4096)   const   varyingThe string to be centered.
Numerisch (ohne Vorzeichen) (10)   const   optionalThe length of the target field.
Return value:
Zeichen (4096)The centered string.
Exported.

f_containsInvalidCharAt  

Booleanf_containsInvalidCharAt(Zeichen, Integer, Zeichen)
Tests, if a given string contains an invalid character at a given position.
Parameter:
Zeichen (4096)   const   variable size   varyingThe string to test.
Numerisch (Integer) (10)   constThe position that specifies the character to be tested.
Zeichen (256)   const   variable size   varyingList of valid characters.
Return value:
BooleanReturns cTrue, if the character at the specified position is valid, else cFalse.
Exported.

f_containsStringAt  

Booleanf_containsStringAt(Zeichen, Integer, Zeichen)
Tests, if a given string contains a specific string at a given position.
Parameter:
Zeichen (4096)   const   variable size   varyingThe string to test.
Numerisch (Integer) (10)   constThe position that specifies the start position of the embedded sub string.
Zeichen (4096)   const   variable size   varyingThe sub string.
Return value:
BooleanReturns cTrue, if the sub string is found at the specified position, else cFalse.
Exported.

f_cvtBufferToHexString  

Zeichenf_cvtBufferToHexString(Pointer, ohne Vorzeichen)
Converts a given buffer to a character string of hex values. Example: When i_pBuffer points to a variable that contains 'Hello World', then string is set to 'C88593939640E696999384'.
Parameter:
Pointer   constPointer to a buffer containing bytes.
Numerisch (ohne Vorzeichen) (5)   constSize of buffer.
Return value:
Zeichen (4096)Returns the character string of hex values of i_buffer.
Exported.

f_cvtHexStringToBuffer  

ohne Vorzeichenf_cvtHexStringToBuffer(Zeichen)
Converts a given character string of hex values to a buffer. Example: When i_string contains 'C88593939640E696999384', then buffer is set to 'Hello World'.
Parameter:
Zeichen (4096)   const   variable sizeCharacter string of hex values.
Return value:
Numerisch (ohne Vorzeichen) (5)Returns the size of the bytes sequence represented by i_string.
Exported.

f_ebcdic  

ohne Vorzeichenf_ebcdic(Zeichen)
Returns the EBCDIC value of a given character.
Parameter:
Zeichen (1)   const   optionalThe fill char to return the EBCDIC value of.
Return value:
Numerisch (ohne Vorzeichen) (3)The EBCDIC value of i_char.
Exported.

f_editCode  

Zeichenf_editCode(Pointer, Integer, Integer, Zeichen, Zeichen)
Transforms a numeric from its internal format to a character form suitable for displaying.
Parameter:
Pointer   constAddress of the internal form of the numeric value.
Numerisch (Integer) (10)   constNumber of digits of the numeric value.
Numerisch (Integer) (10)   constNumber of decimal positions of the numeric value.
Zeichen (10)   constType of the numeric value.
Zeichen (2)   constEdit code used for translating the numeric value to a character string.
Return value:
Zeichen (64)Formatted string.
Exported.

f_editWord  

Zeichenf_editWord(Pointer, Integer, Zeichen, Zeichen)
Transforms a numeric from its internal format to a character form suitable for displaying.
Parameter:
Pointer   constAddress of the internal form of the numeric value.
Numerisch (Integer) (10)   constNumber of digits of the numeric value.
Zeichen (10)   constType of the numeric value.
Zeichen (256)   const   varyingEdit word used for translating the numeric value to a character string.
Return value:
Zeichen (512)Formatted string.
Exported.

f_endsWith  

Booleanf_endsWith(Zeichen, Zeichen)
Tests if the specified string ends with the specified suffix.
Parameter:
Zeichen (4096)   const   varyingThe suffix.
Zeichen (4096)   const   varyingThe string that is tested.
Return value:
BooleanReturns TRUE if the string ends with the suffix, else FALSE.
Exported.

f_formatDate  

Zeichenf_formatDate(Datum, Zeichen)
Formats a given date according to a given picture string.
Parameter:
Datum   constDate to be formatted.
Zeichen (128)   const   varyingPicture string representing the desired format.
Return value:
Zeichen (128)Formatted date string.
Exported.

f_formatMemSize  

Zeichenf_formatMemSize(Integer, Zeichen, Integer)
Converts a given memory size in bytes to string.
Parameter:
Numerisch (Integer) (20)   constMemory size in bytes that is converted to string.
Zeichen (2)   optional   omissibleInput: Desired unit of the formatted memory size.
Output: Unit of the formatted memory size.
Default (input ): best fit = '
Possible units:
  • cMEM_SIZE_BYTE
  • cMEM_SIZE_KILO_BYTE
  • cMEM_SIZE_MEGA_BYTE
  • cMEM_SIZE_GIGA_BYTE
  • cMEM_SIZE_TERA_BYTE
  • cMEM_SIZE_PETA_BYTE
  • cMEM_SIZE_EXA_BYTE
  • cMEM_SIZE_TETTA_BYTE
Numerisch (Integer) (3)   const   optional   omissibleNumber of decimal positions. Default: 2
Return value:
Zeichen (128)Formatted memory size string.
Exported.

f_genStrCmp  

Booleanf_genStrCmp(Zeichen, Zeichen, Zeichen)
Compare strings using wildcard characters. (Compare generic)
Parameter:
Zeichen (4096)   const   varyingThe string to be compared with i_mask.
Zeichen (4096)   const   varyingMask. Optionally containing wildcard characters.
Zeichen (2)   const   optionalWildcard characters:
Position 1-1: Ignore group of characters. Default: *
Position 2-2: Ignore single character. Default: ?
Return value:
BooleanReturns cTrue when the strings are equal otherwise cFalse.
Exported.

f_genStrCmpIgnCase  

Booleanf_genStrCmpIgnCase(Zeichen, Zeichen, Zeichen)
Compare strings using wildcard characters. (Compare generic)
Parameter:
Zeichen (4096)   const   varyingThe string to be compared with i_mask.
Zeichen (4096)   const   varyingMask. Optionally containing wildcard characters.
Zeichen (2)   const   optionalWildcard characters:
Position 1-1: Ignore group of characters. Default: *
Position 2-2: Ignore single character. Default: ?
Return value:
BooleanReturns cTrue when the strings are equal.
Exported.

f_getLengthEditCode  

ohne Vorzeichenf_getLengthEditCode(Integer, Integer, Zeichen)
Gets the length of a the formatted string of a given edit code.
Parameter:
Numerisch (Integer) (10)   constNumber of digits of the numeric value.
Numerisch (Integer) (10)   constNumber of decimal positions of the numeric value.
Zeichen (2)   constEdit code used for translating the numeric value to a character string.
Return value:
Numerisch (ohne Vorzeichen) (5)Length of the formatted string.
Exported.

f_getLengthEditWord  

ohne Vorzeichenf_getLengthEditWord(Integer, Zeichen)
Gets the length of a the formatted string of a given edit word.
Parameter:
Numerisch (Integer) (10)   constNumber of digits of the numeric value.
Zeichen (256)   const   varyingEdit word used for translating the numeric value to a character string.
Return value:
Numerisch (ohne Vorzeichen) (5)Length of the formatted string.
Exported.

f_lcase  

Zeichenf_lcase(Zeichen)
Converts a given string to lower case.
Parameter:
Zeichen (4096)   const   varyingThe string to convert to lower case.
Return value:
Zeichen (4096)The string converted to lower case.
Exported.

f_left  

Zeichenf_left(Zeichen, Integer)
Returns the left portion of a string
Parameter:
Zeichen (4096)   const   varyingThe string to return the left portion of.
Numerisch (Integer) (10)   constThe length of the left portion to return.
Return value:
Zeichen (4096)s The left portion if the string.
Exported.

f_objName  

Zeichenf_objName(qobj_t, Zeichen)
Returns the string representation of a qualified object name.
Parameter:
qobj_t   const   data structureQualified object name.
Zeichen (10)   const   optionalName of the library that contains the object specified at i_qObj. If i_lib is used i_qObj behaves like a 10 byte name field that contains the name of the object only.
Return value:
Zeichen (21)The string represenation of the qualified object name.
Exported.

f_parseDate  

Datumf_parseDate(Zeichen, Zeichen)
Parses a string representing a date.
Parameter:
Zeichen (128)   const   varyingString representing a date.
Zeichen (128)   const   varying   optionalPicture string describing the date string.
Return value:
DatumDate
Exported.

f_replace  

Zeichenf_replace(Zeichen, Zeichen, Zeichen, ohne Vorzeichen)
Replaces all occurences of a search argument by a replacement string in a given string.
Parameter:
Zeichen (4096)   const   varyingThe argument that is replaced by the replacement string.
Zeichen (4096)   const   varyingThe replacement string that replaces the search argument.
Zeichen (4096)   const   varyingThe string that contains the search argument.
Numerisch (ohne Vorzeichen) (10)   const   optionalThe position where to start from.
Return value:
Zeichen (4096)The string having the search argument replaced with the replacement string.
Exported.

f_right  

Zeichenf_right(Zeichen, Integer)
Returns the right portion of a string.
Parameter:
Zeichen (4096)   const   varyingThe string to return the right portion of.
Numerisch (Integer) (10)   constThe length of the right portion to return.
Return value:
Zeichen (4096)The right portion if the string.
Exported.

f_rmvKeyword  

Zeichenf_rmvKeyword(Zeichen, Zeichen)
Removes a keyword from a given string.
Parameter:
Zeichen (128)   const   varyingThe keyword to remove from the string.
Zeichen (4096)   const   varyingThe given string.
The keyword parameter must start with the keyword with no leading spaces. Otherwise the keyword is not removed from string.
Return value:
Zeichen (4096)The string without the keyword.
Exported.

f_rmvQuotes  

Zeichenf_rmvQuotes(Zeichen, Zeichen)
Removes quotes from a given string.
Parameter:
Zeichen (4096)   const   varyingThe given string.
Zeichen (1)   constThe quote to be removed from the string.
Return value:
Zeichen (4096)The string without quotes.
Exported.

f_rplUnPrtChars  

Zeichenf_rplUnPrtChars(Zeichen, Zeichen)
Replaces unprintable characters in a given string.
Parameter:
Zeichen (4096)   const   varyingString that may contain unprintable characters.
Zeichen (1)   const   varying   optionalSubstitution character that replaces the unprintable characters.
Return value:
Zeichen (4096)String without any unprintable characters.
Exported.

f_scanR  

Integerf_scanR(Zeichen, Zeichen, Integer)
Returns the last position of a search argument in the source string.
Parameter:
Zeichen (4096)   const   varyingThe search argument that is searched in for.
Zeichen (4096)   const   varyingThe source string.
Numerisch (Integer) (5)   const   optionalStart position.
Return value:
Numerisch (Integer) (5)Returns the start position of the search argument in
Exported.

f_space  

Zeichenf_space(Integer, Zeichen)
Produces an empty string.
Parameter:
Numerisch (Integer) (10)   constThe length of the string to produce.
Zeichen (1)   const   optionalThe fill char of the string. Default: *BLANKS
Return value:
Zeichen (4096)The new string initialized with i_char.
Exported.

f_startsWith  

Booleanf_startsWith(Zeichen, Zeichen)
Tests if the specified string starts with the specified prefix.
Parameter:
Zeichen (4096)   const   varyingThe prefix
Zeichen (4096)   const   varyingThe string that is tested
Return value:
Booleanreturns TRUE if the string starts with the prefix, else FALSE.
Exported.

f_ucase  

Zeichenf_ucase(Zeichen)
Converts a given string to upper case.
Parameter:
Zeichen (4096)   const   varyingThe string to convert to upper case.
Return value:
Zeichen (4096)The string converted to upper case.
Exported.

f_val  

Fliesskommazahlf_val(Zeichen, Zeichen, Zeichen, Zeichen)
Returns the numeric value of a string.
Parameter:
Zeichen (64)   const   varyingA string representing a numeric value.
Zeichen (1)   const   optionalThe decimal point symbol.
Zeichen (1)   const   optionalThe comma symbol.
Zeichen (1)   const   optionalThe currency symbol.
Return value:
Numerisch (Fliesskommazahl) (8,)The numeric value of i_string.
Exported.

f_wordWrap  

Zeichenf_wordWrap(Zeichen, ohne Vorzeichen, ohne Vorzeichen, ohne Vorzeichen)
Performs word wrapping on a given string. Returns the next line of i_string with each call to f_wordWrap().
Parameter:
Zeichen (4096)   const   varyingThe string to be word wrapped.
Numerisch (ohne Vorzeichen) (10)   constLine length.
Numerisch (ohne Vorzeichen) (10)The position to start from. (Should not be changed between calls.)
Numerisch (ohne Vorzeichen) (10)   const   optionalOptions to set. Default: cWORDWRAP_PARAGRAPH_NONE + cWORDWRAP_PARAGRAPH_TRIMR
  • cWORDWRAP_PARAGRAPH_NONE - Do not respect end-of-paragraph markers.cWORDWRAP_PARAGRAPH_MSGD - Respect end-of-paragraph markers of messag descriptions: &N, &B and &P.
  • cWORDWRAP_PARAGRAPH_TEXT - Respect standard text end-of-paragraph markers: \n
  • cWORDWRAP_PARAGRAPH_TRIMR - Remove trailing blanks from result string
Return value:
Zeichen (4096)The next line of i_string.
Exported.

lf_cvtRpgVarTypeToEdtAPIVarClass  

voidlf_cvtRpgVarTypeToEdtAPIVarClass()

lf_wordWrap  

voidlf_wordWrap()