Alpha numeric
Moderators: chulett, rschirm, roy
Alpha numeric
Hi
I need to extract only alpha numeric from the input string
for example 'as df is xx #$ 90:' is the string and i need to extract
'as df is xx 90' in the out put ,can any one help me in coding this.
Thanks in advance
I need to extract only alpha numeric from the input string
for example 'as df is xx #$ 90:' is the string and i need to extract
'as df is xx 90' in the out put ,can any one help me in coding this.
Thanks in advance
Look at the OCONV function in your DS BASIC manual, the token MCP removes unprintable characters. There's other options to remove not letters and numeric values. You could also use EREPLACE, CHANGE, and CONVERT to name the specific values to be replaced or removed.
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
The 'MCA' conversion will return just the alphabetic part, the 'MCN' will do just the numeric but there is no conversion for alphanumeric only. I can do a MATCHES on that pattern, but couldn't get a way to have that answer returned.
You could use the following routine I just clobbered together:
ReturnAlphanumeric(Arg1)
You could use the following routine I just clobbered together:
ReturnAlphanumeric(Arg1)
Code: Select all
WorkString = UPCASE(Arg1) ;** makes comparison easier
StringLen = LEN(WorkString)
Ans = ''
FOR Index = 1 TO StringLen
TestChar = WorkString[Index,1]
IF TestChar < 'A' OR TestChar > 'Z'
THEN
IF TestChar = ' ' OR (TestChar => '0' AND TestChar <= '9') THEN Ans := Arg1[Index,1]
END
ELSE Ans := Arg1[Index,1]
NEXT I
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
If you put this in a function it would work great also:
I hope you get the idea. :D
Code: Select all
Ans = Arg1
CONVERT "`!@#$%^&*()_+~-=;:,./<>?\|'" TO "" IN Ans
CONVERT '"' TO "" IN Ans
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
True. Missed the 'numeric' part of the 'alpha numeric' question... doh!sun rays wrote:LETTERS Transform would stip off the numeric characters too.chulett wrote:You might want to try using the LETTERS transform that is available under the Built-in/String category. Handles the syntax for you.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
I though about doing the CONVERT, especially since it is more efficient than a user-written routine; but thought that it might contain more than just the standard non-alphanumeric characters. If the poster knows what characters might be in the data then a CONVERT is better, if it might be any string then the posted code, or possibly a CONVERT in combination with a conversion using 'MCP'.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>