42
4
Every Unicode character has a name, like "LATIN CAPITAL LETTER A". A Unicode character name may contain only uppercase letters, white spaces, and the minus sign.
Write a program that reads a text and outputs the names of each character on a new line. For example, if the input were "Hello, World!", the output would be
LATIN CAPITAL LETTER H
LATIN SMALL LETTER E
LATIN SMALL LETTER L
LATIN SMALL LETTER L
LATIN SMALL LETTER O
COMMA
SPACE
LATIN CAPITAL LETTER W
LATIN SMALL LETTER O
LATIN SMALL LETTER R
LATIN SMALL LETTER L
LATIN SMALL LETTER D
EXCLAMATION MARK
- Input should come from a file or from user input, not just a string in code.
- Output should be written to a file or stdout or printed to the screen.
- Internet and external libraries are not allowed, all necessary data should be in the code.
- Assume that the input only contains printable ASCII characters in the Basic Latin code range 32-126. You can ignore a trailing newline.
- All programming languages allowed. Shortest code in bytes wins.
The official Unicode character names can be found here. Other sources:
- http://www.w3schools.com/charsets/ref_utf_basic_latin.asp
- http://www.ssec.wisc.edu/~tomw/java/unicode.html#x0000
This is my first question so I'd appreciate any suggestion if this can be improved.
For the purpose of this challenge the list below shall be normative.
32 0020 SPACE
! 33 0021 EXCLAMATION MARK
" 34 0022 QUOTATION MARK
# 35 0023 NUMBER SIGN
$ 36 0024 DOLLAR SIGN
% 37 0025 PERCENT SIGN
& 38 0026 AMPERSAND
' 39 0027 APOSTROPHE
( 40 0028 LEFT PARENTHESIS
) 41 0029 RIGHT PARENTHESIS
* 42 002A ASTERISK
+ 43 002B PLUS SIGN
, 44 002C COMMA
- 45 002D HYPHEN-MINUS
. 46 002E FULL STOP
/ 47 002F SOLIDUS
0 48 0030 DIGIT ZERO
1 49 0031 DIGIT ONE
2 50 0032 DIGIT TWO
3 51 0033 DIGIT THREE
4 52 0034 DIGIT FOUR
5 53 0035 DIGIT FIVE
6 54 0036 DIGIT SIX
7 55 0037 DIGIT SEVEN
8 56 0038 DIGIT EIGHT
9 57 0039 DIGIT NINE
: 58 003A COLON
; 59 003B SEMICOLON
< 60 003C LESS-THAN SIGN
= 61 003D EQUALS SIGN
> 62 003E GREATER-THAN SIGN
? 63 003F QUESTION MARK
@ 64 0040 COMMERCIAL AT
A 65 0041 LATIN CAPITAL LETTER A
B 66 0042 LATIN CAPITAL LETTER B
C 67 0043 LATIN CAPITAL LETTER C
D 68 0044 LATIN CAPITAL LETTER D
E 69 0045 LATIN CAPITAL LETTER E
F 70 0046 LATIN CAPITAL LETTER F
G 71 0047 LATIN CAPITAL LETTER G
H 72 0048 LATIN CAPITAL LETTER H
I 73 0049 LATIN CAPITAL LETTER I
J 74 004A LATIN CAPITAL LETTER J
K 75 004B LATIN CAPITAL LETTER K
L 76 004C LATIN CAPITAL LETTER L
M 77 004D LATIN CAPITAL LETTER M
N 78 004E LATIN CAPITAL LETTER N
O 79 004F LATIN CAPITAL LETTER O
P 80 0050 LATIN CAPITAL LETTER P
Q 81 0051 LATIN CAPITAL LETTER Q
R 82 0052 LATIN CAPITAL LETTER R
S 83 0053 LATIN CAPITAL LETTER S
T 84 0054 LATIN CAPITAL LETTER T
U 85 0055 LATIN CAPITAL LETTER U
V 86 0056 LATIN CAPITAL LETTER V
W 87 0057 LATIN CAPITAL LETTER W
X 88 0058 LATIN CAPITAL LETTER X
Y 89 0059 LATIN CAPITAL LETTER Y
Z 90 005A LATIN CAPITAL LETTER Z
[ 91 005B LEFT SQUARE BRACKET
\ 92 005C REVERSE SOLIDUS
] 93 005D RIGHT SQUARE BRACKET
^ 94 005E CIRCUMFLEX ACCENT
_ 95 005F LOW LINE
` 96 0060 GRAVE ACCENT
a 97 0061 LATIN SMALL LETTER A
b 98 0062 LATIN SMALL LETTER B
c 99 0063 LATIN SMALL LETTER C
d 100 0064 LATIN SMALL LETTER D
e 101 0065 LATIN SMALL LETTER E
f 102 0066 LATIN SMALL LETTER F
g 103 0067 LATIN SMALL LETTER G
h 104 0068 LATIN SMALL LETTER H
i 105 0069 LATIN SMALL LETTER I
j 106 006A LATIN SMALL LETTER J
k 107 006B LATIN SMALL LETTER K
l 108 006C LATIN SMALL LETTER L
m 109 006D LATIN SMALL LETTER M
n 110 006E LATIN SMALL LETTER N
o 111 006F LATIN SMALL LETTER O
p 112 0070 LATIN SMALL LETTER P
q 113 0071 LATIN SMALL LETTER Q
r 114 0072 LATIN SMALL LETTER R
s 115 0073 LATIN SMALL LETTER S
t 116 0074 LATIN SMALL LETTER T
u 117 0075 LATIN SMALL LETTER U
v 118 0076 LATIN SMALL LETTER V
w 119 0077 LATIN SMALL LETTER W
x 120 0078 LATIN SMALL LETTER X
y 121 0079 LATIN SMALL LETTER Y
z 122 007A LATIN SMALL LETTER Z
{ 123 007B LEFT CURLY BRACKET
| 124 007C VERTICAL LINE
} 125 007D RIGHT CURLY BRACKET
~ 126 007E TILDE
4
Hi, I've gone ahead and edited your question, roll back if you disagree. You don't need more sources of the information, you need one, normative version in the question, to avoid issues with discrepancies. I picked http://www.ssec.wisc.edu/~tomw/java/unicode.html#x0000 as it was the most concise. Other than that, +1
– Level River St – 2015-09-06T15:21:27.683Thanks for the edit @steveverrill, I was too lazy to do that myself. – me and my cat – 2015-09-06T15:26:11.183
Apparently the values are available as part of Windows, in
C:\Windows\System32\getuname.dll
. Does this also count as an "external library", even if it's built in to Windows? – lc. – 2015-09-07T12:18:11.4306I just learned the word solidus. – Luke – 2015-09-23T18:20:02.583