Hi All ,
I have a requirment to extract the data that comes after 0 .
ex: EM0000000000000592176
Need to fetch 592176
The number of zeros may vary
ex:EM00789892
Output :789892
When we try with Field(Arg1,"0",1) this will provide EM .
Please let me know how to get data after 0
Extracting the data after zero
Moderators: chulett, rschirm, roy
Assuming that the string will always have at least one zero:
Code: Select all
Trim(Field(Arg1,'0',2,999),'0','L')
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Is the target column a string?
Hmmm... I think the leading "EM" is going to negate your approach, Arnd.
I was thinking you could find the first '0' starting from the back and then substring from there but zeroes in the number itself would hork that up. Seems you might need to find the first zero, then start from there to find the first non-zero and take from there to the end.
Or remove all of the non-numerics (the 'double convert' comes to mind) and then strip the leading zeroes. I'm sure there are other ways to skin this cat.
Hmmm... I think the leading "EM" is going to negate your approach, Arnd.
I was thinking you could find the first '0' starting from the back and then substring from there but zeroes in the number itself would hork that up. Seems you might need to find the first zero, then start from there to find the first non-zero and take from there to the end.
Or remove all of the non-numerics (the 'double convert' comes to mind) and then strip the leading zeroes. I'm sure there are other ways to skin this cat.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Arnd's approach is totally valid.
This is a server job, so data type conversion will be automatic.
Another solution is DIGITS(InLink.TheString) + 0 (performing any arithmetic removes leading zeroes).
This is a server job, so data type conversion will be automatic.
Another solution is DIGITS(InLink.TheString) + 0 (performing any arithmetic removes leading zeroes).
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.