Can IMAN remove leading zeroes from a string? (4 replies)
Hi Arline,
This should remove leading zeros from any string.
Dim Result Result = %INVOICENO While Left(Result,1) = "0" AND Result "" Result = Right(Result,Len(Result)-1) Wend Result
Dim Result Result = %INVOICENO While Left(Result,1) = "0" AND Result "" Result = Right(Result,Len(Result)-1) Wend Result
Arline, on the part where it says Result "" it should have a less than and a greater than i.e. not equal.
You guys are the best. This worked perfectly! ? Thank you so much.
Dim Result
Result = %INVOICENO
While Left(Result,1) = "0" AND Result ""
Result = Right(Result,Len(Result)-1)
Wend
Result
Not sure what's up with my paste, but I definitely had " Result "" " where you suggested it- thanks again.
Hi there,
Not sure if this is possible. The goal is to remove any leading zeroes from a string that represents %INVOICENO field within my transform. The data values can be any kind of string.
Examples:
000002458-579854
00CM3221
00IV180410091
00000000000N64675
Desired results:
2458-579854
CM3221
IV180410091
N64675
I checked the conversion functions page (https://www.realisable.co.uk/support/documentation/iman-user-guide/Reference/ConversionFunctions.htm) which made me think I could handle this easily for a numeric value but I'm not sure if we can cope with a string value. I saw the below work for another person in another context but had trouble translating it to IMAN:
Function trimLeadingChar(0 As String, %INVOICENO As String) As String
Dim lngLC As Long
For lngLC = 1 To Len(%INVOICENO)
If Mid(%INVOICENO, lngLC, 1) Left(0, 1) Then
trimLeadingChar = Right(%INVOICENO, Len(%INVOICENO) - lngLC + 1)
Exit Function
End If
Next lngLC
trimLeadingChar = ""
Any ideas are welcome.
Thank you,
Arline