Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 3 Tools : GETCHAR

GETCHAR
Returns the first character from the specified string, removing it from the string. (F)
Invocation
character = GETCHAR(string)
 
Syntax and Length of Arguments
 
C (fixed-length character string)
V (variable-length character string)
Usage Notes
If string is null, a null string is returned.
string must be a field of a table or a local variable. It cannot be a constant value because string is changed by GETCHAR.
Example
The following rule gets the first character from a string, gets the next remaining character, and prints the appropriate characters and strings to the message log:

 
GETCHAR_1;
_ LOCAL SOURCE_STRING, STRIP_CHAR;
_ ------------------------------------------------------------------------
_ ------------------------------------------------------------+-----------
_ SOURCE_STRING = 'THIS IS THE SOURCE STRING'; | 1
_ STRIP_CHAR = GETCHAR(SOURCE_STRING); | 2
_ CALL MSGLOG('THE FIRST STRIPPED CHARACTER IS: ' || | 3
_ STRIP_CHAR); |
_ CALL MSGLOG('THE SOURCE STRING IS NOW: ' || SOURCE_STRING | 4
_ ); |
_ STRIP_CHAR = GETCHAR(SOURCE_STRING); | 5
_ CALL MSGLOG('THE SECOND STRIPPED CHARACTER IS: ' || | 6
_ STRIP_CHAR); |
_ CALL MSGLOG('THE SOURCE STRING IS NOW: ' || SOURCE_STRING | 7
_ ); |
_ ------------------------------------------------------------------------

 
Output for the GETCHAR_1 Rule
Pressing PF2 after executing this rule displays the following on the screen:

 
----------------------- INFORMATIONAL MESSAGE LOG --------------------
COMMAND ===> SCROLL ===> P
THE FIRST STRIPPED CHARACTER IS: T
THE SOURCE STRING IS NOW: HIS IS THE SOURCE STRING
THE SECOND STRIPPED CHARACTER IS: H
THE SOURCE STRING IS NOW: IS IS THE SOURCE STRING

 

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved