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

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.

主站蜘蛛池模板: 高安市| 沂水县| 六安市| 色达县| 沿河| 云梦县| 徐闻县| 丽水市| 庄浪县| 镇雄县| 枣庄市| 南康市| 商城县| 日照市| 广水市| 建阳市| 沭阳县| 浠水县| 三穗县| 蓬莱市| 瑞昌市| 保亭| 寿宁县| 宕昌县| 宝清县| 丽江市| 安康市| 潍坊市| 龙门县| 宜川县| 万安县| 乐陵市| 山东省| 萨迦县| 阜平县| 轮台县| 洞头县| 安阳县| 钟祥市| 吉隆县| 梓潼县|