I need to count the appearance of Upper case and Lower case letter.
I used SET CONTROL 'L' to avoid converting characters to upper case.
how can I examine for upper case letters/ lower case letters
I will really appreciate your help Thanks
Search for Upper case and Lower case letter
- RGZbrog
- Posts: 101
- Joined: Mon Nov 23, 2009 1:34 pm
- Skillset: Natural, Adabas, Predict, Natural Security, Construct, EntireX, SPoD, NaturalONE
- Referer: SAG Developer Forum
- Location: California, USA
- Contact:
Re: Search for Upper case and Lower case letter
The MASK conditional can be used to test for upper or lower case characters in an alphanumeric variable. REDEFINE the variable so that you can test character by character.
Code: Select all
DEFINE DATA LOCAL
1 #M (I4) CONST <25>
1 #ALPHA (A25) INIT <'A1b2 C3d4 E5f6 G7h8 I9J0'>
1 REDEFINE #ALPHA
2 #A (A1/#M)
1 #U (I4)
1 #L (I4)
1 #I (I4)
END-DEFINE
FOR #I = 1 #M
DECIDE FOR FIRST CONDITION
WHEN #A (#I) = MASK (U)
ADD 1 TO #U
WHEN #A (#I) = MASK (L)
ADD 1 TO #L
WHEN NONE
IGNORE
END-DECIDE
END-FOR
DISPLAY (SG=F)
'String' #ALPHA
'Upper' #U
'Lower' #L
END
-
- Similar Topics
- Replies
- Views
- Last post
-
-
Output of rexx is coming in UPPER Case only
by arya_starc » Thu Jan 12, 2023 3:41 pm » in CLIST & REXX - 4
- 2373
-
by sergeyken
View the latest post
Fri Jan 13, 2023 1:44 am
-