String Manipulation (AREV Specific)
At 24 MAR 2000 01:39:09PM Bruce wrote:
Hello,
I have what should be an easy one. I have tried to use the locate to do this. I have a string 82.00-. I need to determine if the string contains a post negative sign and move it to the front before I convert the string to a decimal. I have not found a utility to locate the presence of a negative. I can do it with a for loop.
Any Ideas. It would appear the Locate is capable of this.
Thanks Bruce.
At 24 MAR 2000 01:50PM [url=http://www.sprezzatura.com" onMouseOver=window.status=Click here to visit our web site?';return(true)]The Sprezzatura Group[/url] wrote:
String=82.00-'
If String-1, 1=-' Then
String-1,1='String=-' : StringEnd
World Leaders in all things RevSoft
At 24 MAR 2000 01:52PM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:
If Value -1, 1 =-" Then Value-1,1=" Value = "-" : Value EndWorld Leaders in all things RevSoft
At 24 MAR 2000 05:43PM Steve Smith wrote:
LOCATE . . . seeks a value in an array, setting a variable to indiciate position within the array
INDEX() is a function which looks for a character or character sequence in a string, returning the offset within the string
Same concept, but one's for arrays, one's for strings.
Steve
At 25 MAR 2000 11:59PM Richard Hunt wrote:
Steve… if my assumptions are correct, you can use a very simple routine.
If you are always going to have a number to convert, then you can do this…
Given that the variable STRING=82.00-'
STRING=ICONV(STRING,'MD2')
STRING=OCONV(STRING,'MD2')
The final result in STRING will be "-82.00". The ICONV and OCONV conversion routines will handle moving the negative sign for you.
At 26 MAR 2000 03:01AM Steve Smith wrote:
Yes, Richard, you're absolutely correct.
I guess Bruce now has some alternatives.
The string options are the most efficient,
followed by the INDEX() then the ICONV/OCONVs.
We know little of the data consistency
and what to expect in this context.
Steve