This is a discussion on Re: non alpha characters cleaning strings ?? within the Informix forums, part of the Database Server Software category; --> Real Ugly but it works and maybe easier than installing the datablade: create procedure rm_nonalpha(p_char varchar(50,1)) returning varchar(50,1); define ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Real Ugly but it works and maybe easier than installing the datablade: create procedure rm_nonalpha(p_char varchar(50,1)) returning varchar(50,1); define i, mlen smallint; define my_return varchar(50,1); let my_return = ""; let mlen = length(p_char); for i = 1 to mlen if substr(p_char,i,1) in ("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z") then let my_return = my_return || substr(p_char,i,1); end if; end for; return my_return; end procedure; execute procedure rm_nonalpha("ab-cDe'fg ^hi\jk@l#m%"); ----- Original Message ----- From: Floyd Wellershaus To: Obnoxio The Clown Cc: informix-list@iiug.org Sent: Saturday, March 17, 2007 12:29 PM Subject: Re: non alpha characters cleaning strings ?? Hmm. I see the regexp.1.0. It is only for SunOS and Windows. Kinda leaves me out in the cold with AIX. ======================== -<<Floyd Wellershaus>>- Database Administrator Unix Administrator email: fwellers@yahoo.com Home: 703-430-0805 Cell: 703-477-6045 ======================== http://www.one.org/ ----- Original Message ---- From: Obnoxio The Clown <obnoxio@serendipita.com> To: Floyd Wellershaus <fwellers@yahoo.com> Cc: informix-list@iiug.org Sent: Saturday, March 17, 2007 11:21:29 AM Subject: Re: non alpha characters cleaning strings ?? Floyd Wellershaus said: > You mean the regexp blade is free ? Yep. -- Bye now, Obnoxio "I'm astonished anyone pays real money for this crap." -- Cosmo -- This message has been scanned for viruses and dangerous content by OpenProtect(http://www.openprotect.com), and is believed to be clean. ------------------------------------------------------------------------------ _______________________________________________ Informix-list mailing list Informix-list@iiug.org http://www.iiug.org/mailman/listinfo/informix-list |
| ||||
| This would be more elegant: if substr(p_char,i,1) matches "[a-zA-Z]" then -- Regards, Doug Lawry www.douglawry.webhop.org "Ben" <ben_informix@comcast.net> wrote in message news:mailman.454.1174400313.10648.informix-list@iiug.org... Real Ugly but it works and maybe easier than installing the datablade: create procedure rm_nonalpha(p_char varchar(50,1)) returning varchar(50,1); define i, mlen smallint; define my_return varchar(50,1); let my_return = ""; let mlen = length(p_char); for i = 1 to mlen if substr(p_char,i,1) in ("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z") then let my_return = my_return || substr(p_char,i,1); end if; end for; return my_return; end procedure; execute procedure rm_nonalpha("ab-cDe'fg ^hi\jk@l#m%"); ----- Original Message ----- From: Floyd Wellershaus To: Obnoxio The Clown Cc: informix-list@iiug.org Sent: Saturday, March 17, 2007 12:29 PM Subject: Re: non alpha characters cleaning strings ?? Hmm. I see the regexp.1.0. It is only for SunOS and Windows. Kinda leaves me out in the cold with AIX. ======================== -<<Floyd Wellershaus>>- Database Administrator Unix Administrator email: fwellers@yahoo.com Home: 703-430-0805 Cell: 703-477-6045 ======================== http://www.one.org/ ----- Original Message ---- From: Obnoxio The Clown <obnoxio@serendipita.com> To: Floyd Wellershaus <fwellers@yahoo.com> Cc: informix-list@iiug.org Sent: Saturday, March 17, 2007 11:21:29 AM Subject: Re: non alpha characters cleaning strings ?? Floyd Wellershaus said: > You mean the regexp blade is free ? Yep. -- Bye now, Obnoxio |