String: How do I check if the character belongs to one of the characters?
I have a string. I want to know if the 1st characters of the string belongs to one of the character set or not.
For example, the character set is A, B, E, Z, T.
Right now, what I did was:
IF str+0(1) EQ 'A' OR str+0(1) EQ 'B' OR str+0(1) EQ 'E' OR str+0(1) EQ 'Z' OR ......
Is there a shorter way to do it?
Please help and I will reward you.
Use CA operator
data : string1 type TABLE OF string WITH HEADER LINE. APPEND 'ABCDEF' to string1. APPEND 'BBCDEF' to string1. APPEND 'CBCDEF' to string1. APPEND 'DBCDEF' to string1. APPEND 'EBCDEF' to string1. LOOP AT string1. check string1+0(1) CA 'ABE'. write: / sy-tabix,'found'. ENDLOOP.