Commands & Syntax > Commands > Variable Manipulation >

PARSE - < var_parse >() ... [Pro]

www.perfectkeyboard.com

 

Variable PARSE
<var_parse>("Input text/variable","Delimiter","Trim character",Variable array for enumerated items,Variable array size)
Available in: Professional edition

This command parses input text (variable value). Parts of the input text are expected to be delimited by characters (space, comma, new line, etc.) defined as a command parameter. The parsed parts of the input text are saved in parameter variable (array). In addition, each parsed part can be trimmed using characters defined.

 

#

Parameter name

Parameter description

1

Input text/variable

Text (or variable containing text) to be parsed.

2

Delimiter

Characters used to delimit input text (for example, dot, comma, space new line, etc.).

3

Trim character

Characters used to trim each parsed part of the input text.

4

Variable array for enumerated items

Variable (array) that receives each input text piece parsed.

5

Variable array size

Variable that receives the number of pieces.

 

Example (Macro Steps):

 

1

<#> <#> This example shows how to use command

2

<#> <#> The input text consisting from names delimited by comma

3

<#> <#> will be parsed and each name will be shown in message box.

4

Macro execution: ONLY COMMANDS

5

Variable PARSE "Peter, Paul, John, Jim " to variable array "vName" (Delimiter = ,, Trim character = , Variable array for enumerated items = vName, Variable array size = vNumOfNames)

6

Loop BEGIN Repeat = vNumOfNames

7

Message SHOW "" : "vName[_vLoopCounter0]" (other parameters: x = 100, y = 100, Window title = Message, Buttons = OK, Timeout (seconds) = , Always on top = ).

8

Loop END

Example (Plain Text):

 

<#> This example shows how to use <var_parse> command

<#> The input text consisting from names delimited by comma

<#> will be parsed and each name will be shown in message box.

<cmds>

<var_parse>("Peter,  Paul,  John,   Jim  ",","," ",vName,vNumOfNames)

<begloop>(vNumOfNames)

   <msg>(100,100,"vName[_vLoopCounter0]","Message",1)

<endloop>