I want to remove the 0 if it is 4th byte from the given number.
Eg
123045678 -- i need 12345678
9870124 -- i need 987124
80124578 -- i need 80124578
Pls. help, Thanks in Advance
Vijay
In a given number if the fourth digit is 0 i wanto remove th
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 612
- Joined: Thu May 03, 2007 4:59 am
- Location: Melbourne
You can try something like this :
Code: Select all
if In.string[4,1] = 0 then In.string[4,1] = '' Else In.string
or
if In.string[4,1] = 0 then In.string[1,3]:In.string[5,Len(In.string)] Else In.string
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The first suggestion won't work, because you can't have an assignment statement in an expression. (In.string[4,1] = '') will be treated as a comparison expression and always return 0 (for False).
The second suggestion is a good one.
The second suggestion is a good one.
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: 612
- Joined: Thu May 03, 2007 4:59 am
- Location: Melbourne
Rightly said, only the second one will work
Code: Select all
if In.string[4,1] = 0 then In.string[1,3]:In.string[5,Len(In.string)] Else In.string
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>