all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
6
Task/String-case/REXX/string-case-1.rexx
Normal file
6
Task/String-case/REXX/string-case-1.rexx
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
abc = "abcdefghijklmnopqrstuvwxyz" /*define all the lowercase letters*/
|
||||
abcU = translate(abc) /* " " " uppercase " */
|
||||
|
||||
x = 'alphaBETA' /*define string to a REXX variable*/
|
||||
y = translate(x) /*uppercase X and store it───► Y*/
|
||||
z = translate(x, abc, abcU) /*tran uppercase──►lowercase chars*/
|
||||
5
Task/String-case/REXX/string-case-2.rexx
Normal file
5
Task/String-case/REXX/string-case-2.rexx
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
x = "alphaBETA" /*define string to a REXX variable*/
|
||||
parse upper var x y /*uppercase X and store it───► Y*/
|
||||
parse lower var x z /*lowercase X " " " ───► Z*/
|
||||
|
||||
/*Some REXXes don't support the LOWER option for the PARSE command.*/
|
||||
6
Task/String-case/REXX/string-case-3.rexx
Normal file
6
Task/String-case/REXX/string-case-3.rexx
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
x = 'alphaBETA' /*define string to a REXX variable*/
|
||||
y = upper(x) /*uppercase X and store it───► Y*/
|
||||
z = lower(x) /*lowercase X " " " ───► Z*/
|
||||
|
||||
/*Some REXXes don't support the UPPER and */
|
||||
/* LOWER BIFs (built-in functions). */
|
||||
5
Task/String-case/REXX/string-case-4.rexx
Normal file
5
Task/String-case/REXX/string-case-4.rexx
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
x = "alphaBETA" /*define string to a REXX variable*/
|
||||
y=x; upper y /*uppercase X and store it───► Y*/
|
||||
parse lower var x z /*lowercase Y " " " ───► Z*/
|
||||
|
||||
/*Some REXXes don't support the LOWER option for the PARSE command.*/
|
||||
17
Task/String-case/REXX/string-case-5.rexx
Normal file
17
Task/String-case/REXX/string-case-5.rexx
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
/*REXX pgm capitalizes each word in string, maintains imbedded blanks.*/
|
||||
x= "alef bet gimel dalet he vav zayin het tet yod kaf lamed mem nun samekh",
|
||||
"ayin pe tzadi qof resh shin tav." /*"old" spelling Hebrew letters. */
|
||||
y= capitalize(x) /*capitalize each word in string.*/
|
||||
say x /*show original string of words. */
|
||||
say y /*show the capitalized words. */
|
||||
exit /*stick a fork in it, we're done.*/
|
||||
/*───────────────────────────────────CAPITALIZE subroutine──────────────*/
|
||||
capitalize: procedure; parse arg z; $=' 'z /*prefix with a blank.*/
|
||||
abc = "abcdefghijklmnopqrstuvwxyz" /*define all lowercase letters. */
|
||||
|
||||
do j=1 for 26 /*process each letter in alphabet*/
|
||||
_=' 'substr(abc,j,1); _U=_; upper _U /*get a lower and upper letter. */
|
||||
$ = changestr(_, $, _U) /*maybe capitalize some word(s). */
|
||||
end /*j*/
|
||||
|
||||
return substr($,2) /*capitalized words, -1st blank.*/
|
||||
9
Task/String-case/REXX/string-case-6.rexx
Normal file
9
Task/String-case/REXX/string-case-6.rexx
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
/*REXX pgm swaps letter case of a string: lower──►upper & upper──►lower.*/
|
||||
abc = "abcdefghijklmnopqrstuvwxyz" /*define all the lowercase letters*/
|
||||
abcU = translate(abc) /* " " " uppercase " */
|
||||
|
||||
x = 'alphaBETA' /*define string to a REXX variable*/
|
||||
y = translate(x,abc||abcU,abcU||abc) /*swap case of X store it ───► Y*/
|
||||
say x
|
||||
say y
|
||||
/*stick a fork in it, we're done.*/
|
||||
11
Task/String-case/REXX/string-case-7.rexx
Normal file
11
Task/String-case/REXX/string-case-7.rexx
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
x='alphaBETA'; Say ' x='||x
|
||||
Say 'three ways to uppercase'
|
||||
u1=translate(x); Say ' u1='u1
|
||||
u2=upper(x); Say ' u2='u2
|
||||
parse upper var x u3; Say ' u3='u3
|
||||
|
||||
abc ='abcdefghijklmnopqrstuvwxyz'
|
||||
abcu=translate(abc); Say 'three ways to lowercase'
|
||||
l1=translate(x,abc,abcu); Say ' l1='l1
|
||||
l2=lower(x); Say ' l2='l2
|
||||
parse lower var x l3; Say ' l3='l3
|
||||
8
Task/String-case/REXX/string-case-8.rexx
Normal file
8
Task/String-case/REXX/string-case-8.rexx
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
uppercase: /*courtesy Gerard Schildberger */
|
||||
return translate(changestr("ß",translate(arg(1),'ÄÖÜ',"äöü"),'SS'))
|
||||
|
||||
uppercase2: Procedure
|
||||
Parse Arg a
|
||||
a=translate(arg(1),'ÄÖÜ',"äöü") /* translate lowercase umlaute */
|
||||
a=changestr("ß",a,'SS') /* replace ß with SS */
|
||||
return translate(a) /* translate lowercase letters */
|
||||
Loading…
Add table
Add a link
Reference in a new issue