|
|
This function splits up a forwarded string into individual substrings which are assigned to corresponding variables according to the type by means of conversion. The result is the number of sucessfully assigned variables. The function is aborted if the format character string has been comletely processed or if a field in the input string is not appropriate to the conversion specifications. A substring extends to the next space, tab (\t) or line break (\n) or to an explicitely specified field width. Every conversion specification starts with the % character and ends with a conversion character. The space between % and the conversion character could contain the following (in sequence):
|
||||||||||||||||||||||||||||||
| The following letters are used as conversion characters: | |||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||
|
scan is based on the ICU function u_sscanf, so please check the ICU documentation for details on the supported patterns (see the ICU Homepage at http://site.icu-project.org/home). This function must be called in the action part only! |
|||||||||||||||||||||||||||||||
To support I18N, the "u_sscanf" function replaces the standard C function 'sscanf'. For difference and limitations resulting from this change, refer to the Oracle Support Knowledgebase at https://support.oracle.com |
|||||||||||||||||||||||||||||||
Syntax: |
|||||||||||||||||||||||||||||||
| {INT_VAR}= scan({STR_EXPR},{STR_EXPR},{VAR_LIST}) | |||||||||||||||||||||||||||||||
I/O parameters: |
|||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||
Example 1: |
|||||||||||||||||||||||||||||||
| Declaration of Variables | |||||||||||||||||||||||||||||||
10 DOCU_STRING_1 = "45.5 |ABCD 4711 | 33mm"
20 DOCU_INT_1 = scan(DOCU_STRING_1,"%f %*s %4s | %i",
DOCU_FLOAT_1, DOCU_STRING_2,DOCU_INT_2)
30 put(DOCU_FLOAT_1,DOCU_STRING_2,DOCU_INT_2)
|
|||||||||||||||||||||||||||||||
| Result: | |||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||
|
Besides the conversion information '%i', '%f', '%l' and '%s' also regular expressions contained in the ICU standard function 'u_sscanf' are supported. A LogiView string variable must always be included as related output argument. The following conversion information can be used:
|
|||||||||||||||||||||||||||||||
Example 2: |
|||||||||||||||||||||||||||||||
| Declaration of Variables | |||||||||||||||||||||||||||||||
10 DOCU_STRING_1 = "abc*\defg" 20 C -- No special characters must be used 30 DOCU_INT_1 = scan(DOCU_STRING_1,"%[A-Za-z0-9]", DOCU_STRING_2) 40 put(DOCU_STRING_2) |
|||||||||||||||||||||||||||||||
| Result: | |||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||
|
Functions and commands: Editing Strings |
|||||||||||||||||||||||||||||||