Hi all,
I have requirement in which ,i need to change a alphanumeric number to 10 digit number with all the alphabets replaced to "0" including "@,&,%,/" etc and preceding zero's to make it 10 digit .
(e.g):-(1). AF001234 TO 0000001234
(2). N/A TO 0000000000
(3). 1234ERTY TO 0012340000
Can anyone give me with some ideas?
Thanks
ereplace and fmt equivalent in parallel
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 10
- Joined: Mon Feb 22, 2010 1:58 am
- Location: Chennai
ereplace and fmt equivalent in parallel
Vignesh Shanmugam
TCS
Chennai
TCS
Chennai
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
It won't. For starters, there's no If in the expression, even though there are Then and Else. Second, you seem to be assuming some kind of loop through the characters in the string, which does not exist.
Set a stage variable to contain all the characters that must be converted to zero, for example svZeroChars. Create another containing the number of zero characters as there are in svZeroChars, for example svZeroes. Then use Convert() to convert these to zero and any function to pad to length. For example
Set a stage variable to contain all the characters that must be converted to zero, for example svZeroChars. Create another containing the number of zero characters as there are in svZeroChars, for example svZeroes. Then use Convert() to convert these to zero and any function to pad to length. For example
Code: Select all
Right("000000000000":Convert(svZeroChars, svZeroes, InLink.TheString), 12)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 10
- Joined: Mon Feb 22, 2010 1:58 am
- Location: Chennai