官术网_书友最值得收藏!

Characters

Like C or Java, but unlike Python, Julia implements a type for a single character, the Char type. A character literal is written as 'A', where typeof('A') returns Char. A Char value is a Unicode code point, and it ranges from '\0' to '\Uffffffff'. Convert this to its code point with Int(): Int('A') returns 65, and Int('α') returns 945, so this takes two bytes.

The reverse also works: Char(65) returns 'A', Char(945) returns '\u3b1', which is the code point for α (3b1 is hexadecimal for 945).

Unicode characters can be entered by a \u in single quotes, followed by four hexadecimal digits (ranging from 0-9 or A-F), or \U followed by eight hexadecimal digits. The isvalid(Char, value) function can test whether a number returns an existing Unicode character: isvalid(Char,0x3b1) returns true. The normal escape characters, such as \t (tab), \n (newline), \', and so on, also exist in Julia.

主站蜘蛛池模板: 邛崃市| 深州市| 滦南县| 宁化县| 阆中市| 平江县| 德阳市| 肥西县| 大港区| 揭阳市| 洪泽县| 吴忠市| 尉氏县| 敦化市| 泾阳县| 凤阳县| 黄龙县| 娄底市| 黑河市| 习水县| 通河县| 九龙县| 响水县| 驻马店市| 安化县| 宾川县| 多伦县| 南漳县| 卓尼县| 淳安县| 宁南县| 墨玉县| 九寨沟县| 华阴市| 剑阁县| 曲阜市| 象州县| 蓬安县| 鹤峰县| 石家庄市| 徐汇区|