 |
| |
| Change |
| |
| Format #1 |
Change v1 v2 v3 [v4 ] |
|
| Examples |
Change MyVar 'Cat''Dog'
Change MyVar 'Dog''' |
;Change 'Cat'to 'Dog'
;Remove all 'Dog'strings |
| Purpose |
Changes v1 such that every occurrence of v2 is changed to v3 |
| Parameters |
v1 -Variable to be changed
v2 -Value to look for
v3 -Value to replace it with
v4 -Control setting |
| Controls |
MultiPass/OnePass |
| Defaults |
v4 ='MultiPass' |
|
| Similar Cmds |
ChangeCase,KeepChar,MassChange,Padded,TrimChar |
|
| Notes |
The comparison is case-sensitive.'Cat'does not match 'CAT'. |
|
In the default MultiPass mode,the Change command repeats the process until the value being sought (v2)is
no longer found.However,consider this situation:
X ='ABCD'
Change X 'A''AA''MultiPass'
The Change command notices that repeating the process would never end (because v3 contains v2),so it
only scans v1 once. |
| |
| ChangeCase |
| |
| Format |
v1 =ChangeCase v2 [v3 ] |
| Examples |
ChangeCase MyVar 'HardCaps' |
| Purpose |
Changes text case (e.g.'Cat'to 'CAT') |
| Parameters |
v1 -Variable being set
v2 -Original value
v3 -Control setting |
| Similar Cmds |
———————————— ———————————— ————————————
Original (v2) Control (v3) Result (v1)
———————————— ———————————— ————————————
'Fred Jones' 'Uppercase' 'FRED JONES'
'FRED Jones' 'Lowercase' 'fred jones'
'fred jones' 'Capitalize' 'Fred Jones'
'FRED jones' 'Capitalize' 'FRED Jones'
'FRED jones' 'HardCaps' 'Fred Jones'
'WX-XY123' 'HardCaps' 'Wx-Xy123'
'FRED jones' 'NoChange' 'FRED jones'
———————————— ———————————— ———————————— |
| Defaults |
v3 ='Uppercase' |
| Similar Cmds |
Change |
|
| |
| KeepChar |
| |
| Format |
KeepChar v1 v2 |
|
| Examples |
KeepChar MyVar1 '/AZ'
KeepChar MyVar2 '/$/09/.'
KeepChar MyVar '/AZ/az/'
KeepChar MyVar4 '*AZ*az' |
;Retain A to Z only
;Retain $,0 to 9,and period
;Retain only letters
;Same as previous example |
| Purpose |
Filters out everything but the characters and character-
ranges specified. |
| Parameters |
v1 -Variable being modified
v2 -Control setting |
|
| Similar Cmds |
Change,TrimChar |
|
|
The first character of the control setting (v2)is the delimiter that will separate the characters or pairs of
characters.Paired characters represent a range,while single characters represent precisely that character. |
| |
| Padded |
| |
| Format |
v1 =Padded v2 v3 [v4 [v5 ]] |
|
| Examples |
MyVar1 =Padded 'AB'4
MyVar2 =Padded 'CD'5 'Left'
MyVar =Padded 'EF'6 'Center'
MyVar5 =Padded 'XYZ'7 'Left''x' |
;'AB '
;'CD'
;'EF '
;'xxxxXYZ' |
| Purpose |
Pads a value to a specific length (number of characters) |
| Parameters |
v1 -Variable being set
v2 -Original value
v3 -Length of result (number of characters)
v4 -Edge to pad:'Left''Right''Center'
v5 -Character with which to pad |
|
| Defaults |
v4 ='Right'
v5 =''(i.e.a space) |
|
| Similar Cmds |
Change,Insert |
|
|
| |
| TrimChar |
| |
| Format |
TrimChar v1 [v2 ] |
| Examples |
TrimChar MyVar1
TrimChar MyVar2 'B M,L R$' |
| Purpose |
Removes unwanted characters from a variable |
| Parameters |
v1 -Variable to be changed
v2 -Trimming specifications |
| Defaults |
v2 ='B ' |
| Similar Cmds |
KeepChar |
|
| |
The “trimming specifications ” comprises pairs of characters describing how you want the variable trimmed.
Each pair of characters is treated as follows:
• The first character is the instruction (e.g.B =Both edges)
• The second character is the actual character you want trimmed away
Here is an explanation of the various trimming instructions:
|
| ———————————— |
————————————————————————————————————————————————————————— |
| Instruction |
Meaning |
| ———————————— |
————————————————————————————————————————————————————————— |
| A |
Trim all instances of the character |
| B |
Trim both sides of the variable (left and right) |
| L |
Trim the left side of the variable |
| R |
Trim the right side of the variable |
| M |
Replace multiple instances of the character with just one |
| ———————————— |
————————————————————————————————————————————————————————— |
|
Consider the following variable:
MyVar ='xxx///yyy zzz///'; Note the spaces on both ends
Here is how various trimming specifications would affect the xyz variable: |
| |
| —————————— |
—————————————————— |
—————————— |
——————————————————— |
| Trim Spec |
Result |
Trim Spec |
Result |
| —————————— |
—————————————————— |
—————————— |
——————————————————— |
| 'L ' |
'xxx///yyy zzz///' |
'R ' |
'xxx///yyy zzz///' |
| 'B ' |
'xxx///yyy zzz///' |
'A ' |
'xxx///yyyzzz///' |
| 'B Ay' |
'xxx///zzz///' |
'A Az' |
'xxx///yyy///' |
| 'M/' |
'xxx/yyy zzz/' |
'B M/' |
'xxx/yyy zzz/' |
| 'MxMyMzM/' |
'x/y z/' |
'B Lx' |
'xxx///yyy zzz///' |
| —————————— |
—————————————————— |
—————————— |
——————————————————— |
|
| |
As you can see from the 'B Lx'example,the trimming instructions are executed simultaneously.If you want
to trim both spaces and then trim off the leading x's,you need to do two TrimChar commands in a row.(This page is part of the
online user manual for Parse-O-Matic. Parse-O-Matic is a
programmable parsing tool that can extract, manipulate, convert or mine
existing data sources and turn them into importable data. For more
information on Parse-O-Matic products and conversion services, please
visit www.ParseOMatic.com) |
| |
| |