2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -1,31 +1,18 @@
/*REXX program shows ways to use and express binary strings. */
dingsta='11110101'b /*4 versions, bit str assignment.*/
dingsta="11110101"b /*same as above. */
dingsta='11110101'B /*same as above. */
dingsta='1111 0101'B /*same as above. */
dingst2=dingsta /*clone 1 str to another (copy). */
other='1001 0101 1111 0111'b /*another binary (bit) string. */
if dingsta=other then say 'they are equal' /*compare two strings.*/
if other=='' then say 'OTHER is empty.' /*see if it's empty. */
if length(other)==0 then say 'OTHER is empty.' /*another version. */
otherA=other || '$' /*append a dollar sign to OTHER. */
otherB=other'$' /*same as above, with less fuss. */
guts=substr(c2b(other),10,3) /*get the 10th through 12th bits.*/
/*see sub below. Some REXXes */
/*have C2B as a built-in function*/
new=changestr('A',other,"Z") /*change the letter A to Z. */
tt=changestr('~~',other,";") /*change 2 tildes to a semicolon.*/
joined=dignsta || dingst2 /*join 2 strs together (concat). */
exit /*stick a fork in it, we're done.*/
/*─────────────────────────────────C2B subroutine───────────────────────*/
c2b: return x2b(c2x(arg(1))) /*return the string as a binary string. */
/*REXX program demonstrates methods (code examples) to use and express binary strings.*/
dingsta= '11110101'b /*four versions, bit string assignment.*/
dingsta= "11110101"b /*this is the same assignment as above.*/
dingsta= '11110101'B /* " " " " " " " */
dingsta= '1111 0101'B /* " " " " " " */
dingsta2=dingsta /*clone one string to another (a copy).*/
other= '1001 0101 1111 0111'b /*another binary (or bit) string. */
if dingsta=other then say 'they are equal' /*compare the two (binary) strings. */
if other=='' then say 'OTHER is empty.' /*see if the OTHER string is empty.*/
otherA=other || '$' /*append a dollar sign ($) to OTHER. */
otherB=other'$' /*same as above, but with less fuss. */
guts=substr(c2b(other), 10, 3) /*obtain the 10th through 12th bits.*/
new=changeStr('A', other, "Z") /*change the upper letter A ──► Z. */
tt=changeStr('~~', other, ";") /*change two tildes ──► one semicolon.*/
joined=dignsta || dingsta2 /*join two strings together (concat). */
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
c2b: return x2b( c2x( arg(1) ) ) /*return the string as a binary string.*/