Idiomatically determine all the characters that can be used for symbols: Difference between revisions
added a new Rosetta Code task (idiomatically determine all the characters that can be used for symbols). |
m added a Rosetta Code link. |
||
Line 9: | Line 9: | ||
Display the set of all the characters that can be used for symbols which can be used (allowed) by the computer program. |
Display the set of all the characters that can be used for symbols which can be used (allowed) by the computer program. |
||
You may want to mention what hardware architecture is being used, and if applicable, the operating system. |
<br>You may want to mention what hardware architecture is being used, and if applicable, the operating system. |
||
Note that most languages have additional restrictions on what characters can't be used for the first character of a variable or statement label, for instance. These type of restrictions needn't be addressed here (but can be mentioned). |
Note that most languages have additional restrictions on what characters can't be used for the first character of a variable or statement label, for instance. These type of restrictions needn't be addressed here (but can be mentioned). |
||
⚫ | |||
;Cf: |
|||
* [[Idiomatically_determine_all_the_lowercase_and_uppercase_letters|Idiomatically determine all the lowercase and uppercase letters]]. |
|||
⚫ | |||
=={{header|REXX}}== |
=={{header|REXX}}== |
Revision as of 16:23, 21 March 2014
Idiomatically determine all the characters that can be used for symbols
The method should find the characters regardless of the hardware architecture that is being used (ASCII, EBCDIC, or other).
- task requirements
Display the set of all the characters that can be used for symbols which can be used (allowed) by the computer program.
You may want to mention what hardware architecture is being used, and if applicable, the operating system.
Note that most languages have additional restrictions on what characters can't be used for the first character of a variable or statement label, for instance. These type of restrictions needn't be addressed here (but can be mentioned).
- Cf
REXX
<lang rexx>/*REXX program determines what characters are valid for REXX symbols.*/ @= /*set symbol characters " " */
do j=0 for 2**8 /*traipse through all the chars. */ _=d2c(j) /*convert decimal number to char.*/ if datatype(_,'S') then @=@ || _ /*Symbol char? Then add to list.*/ end /*j*/ /* [↑] put some chars into a list*/
say ' symbol characters: ' @ /*display all symbol characters.*/
/*stick a fork in it, we're done.*/</lang>
Programming note: REXX allows any symbol to begin a (statement) label, but variables can't begin with a period (.) or a numeric digit.
All examples below were executed on a (ASCII) PC using Windows/XP and Windows/7 with code page 437 in a DOS window.
Using PC/REXX and
Using Personal REXX and
Using Regina (versions 3.2 ───► 3.7)
output
symbol characters: !#$.0123456789?@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz
Using R4
output
symbol characters: !#$.0123456789?@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyzÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£áíóúñÑ╡╢╖─╞╟╨╤╥╙╘╒╓╫╪▐αßΓπΣσµτΦΘΩδ∞φ
Using ROO
output
symbol characters: !#$.0123456789?@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyzÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£áíóúñÑ╡╢╖╞╟╨╤╥╙╘╒╓╫╪▐αßΓπΣσµτΦΘΩδ∞φ