To remove all spaces is relatively easy  - 

 (srpl(sourcestring,' ', '',0)) 

The non-alpha replace is a lot  more complicated. 

You would have to parse each value and check each 

character as to whether it is an alpha value or not.  I 

do not believe there is a built in, single command that 

can replace non-alpha characters. 



So with that in mind you would, 

1 - Determine number of characters in source string  with SLEN function 

2 - set a variable to the first character with SGET function 

3 - Perform a check with the ISALPHA function 

4 - If not alpha, do a SRPL command 

5 - repeat for each character location determined from  step #1 



-Bob 

----- Original Message ----- 
From: "Paul Buckley" <[email protected]> 
To: "RBASE-L Mailing List" <[email protected]> 
Sent: Tuesday, November 17, 2009 12:49:34 PM GMT -06:00 US/Canada Central 
Subject: [RBASE-L] - Brain Freeze on Stripping Spaces and Characters from a 
String 

I know I'm missing something simple, probably not enough caffeine today. 
I'm trying to setup a computed column in a table that will strip all spaces 
from the string and replace all the non-alpha or numeric characters with an 
underscore (_).  Here's some examples; First & Third would become 
First_Third, First/Third would become First_Third and Item # would become 
Item_. 

Can someone suggest a way to do this please.  Thanks in advance. 

Paul Buckley 


Reply via email to