Re: Char to Integer
Posted in 2004
I think this would work: if ( string_var matches "*[^0-9]*" ) then <there's a non-digit character in the string> else <it's all digits or NULL> end if You could also allow commas if you wanted. If you want to allow negative integers, make the reg exp "*[^0-9-]*". HTH, Walt. "navdeep virk" <nvirk@msn.com> wrote in message news:c2isnc$rr4$1@terabinaries.xmission.com... > > List , > > I am storing a string variable (which can be integer or alpha ) into an > integer variable to check for alpha character's in the string variable. > The process works fine as I check whether the integer is null after the > assignment ( that is the assigment succeeds or not). null means it could not > convert the string to integer . > > The Problem is that if the assignment fails it generates a error code -1213 > in the error log , which is not desirable . I am using "WHENEVER ERROR > CONTINUE" earlier on in the code. I want to turn of wrror logging only for > this condition . > > Is there a way I can suppress this benign error from being written to the > error log .Pl suggest any other function to check for aplha characters in a > string apart from scanning the whole string and exiting when an alpha > character is found . > > rgds, > > NSV > > _________________________________________________________________ > Fast. Reliable. Get MSN 9 Dial-up - 3 months for the price of 1! > (Limited-time Offer) http://click.atdmt.com/AVE/go/onm00200361ave/direct/01/ > > sending to informix-list