How to clean out non-alphanumeric chars in a string

Question: I have the following value:

DATA: WSTR(10).

Sometimes in WSTR I get non-alphanumeric characters I want to eliminate any value that is not alphanumeric in the WSTR.

Please kindly share the code to eliminate the non-alphanumeric character in WSTR.

Thanks
Anita

Answer:
Build a string of your alphanumeric characters - called, e.g. AN.

Then loop through WSTR one character at a time, eliminating any characters not in AN. Maybe replacing with SPACE.

Regards

m@t
_________________
TULY The quality of answers is roughly proportional to the quality of the question.

The downside of being better than everyone else is that people tend to assume you're pretentious.

Answer:
Doesn't our friend want to get rid of the entire entry that contains non-alphanumerics...

How about trying op CN...

Would that help?


_________________
The Doc
Magna Grand Docot of the Tuly Idiot Order

2007 Basic Rules

Answer:
What about reading the F1 help for MOVE, and especially the conversion rules for C -> N

Answer:
What about reading the F1 help for MOVE, and especially the conversion rules for C -> N
Oops, I mis-read "alphanumeric" as "numeric".

Answer:
** Declare a string containing only spaces the length of your variable wstr.

DATA charsp(10).

charsp = ' '. "The web site HTML will remove the consecutive blanks here. Make charsp ten blank spaces in length.

** Remove non alphanumeric characters.

OVERLAY wstr WITH charsp ONLY '`~!@#$%^&*()_+=-{}[]:;,<.>/?\|'.

CONDENSE wstr.
_________________
ABAP-BE-BOP

Answer:
For your info, you can use "Code" option:

charsp = '          '. "The web site HTML will remove the consecutive blanks here. Make charsp ten blank spaces in length.


_________________
The Doc
Magna Grand Docot of the Tuly Idiot Order

2007 Basic Rules
Copyright ?2007 - 2008 www.jt77.com