View previous topic :: View next topic
|
Author |
Message |
beruoist
New User
Joined: 14 Nov 2007 Posts: 70 Location: mumbai
|
|
|
|
I have a alphanumeric variable which can contain values like below
#X= "ASCBDADJK 903485"
what i have to do is examine the variable and replace all the A-Z to X and 0-9 to 9..rest of the spaces and other characters should be unchanged.
I had thought of one logic.
#I (N2)
#J (N2)
#VAR (A1/1:26) CONST<'A''B''C''D''E''F''G''H''I''J''K''L''M''N''O''P''Q''R''S''T''U''V''W''X''Y''Z'>
#NUM (N1/10) CONST <'1''2''3''4''5''6''7''8''9''0'>
*
*
For #I 1 26
EXAMINE #X for #VAR(#I) replace with 'X'
#I=#I+1
end-for
*
For #J 1 10
EXAMINE #X for #NUM(#J) replace with '9'
#J=#J+1
end-for
*
*
Note- I havent tested this logic yet,Hope this will work fine.
My question is,Is thier is any easier way to do this ? |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
There is no other option. In order for your statements to work as expected, change "replace" to "replace all".
O. |
|
Back to top |
|
|
|