-
Book Overview & Buying
-
Table Of Contents
Getting started with Julia Programming Language
By :
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', typeof('A') returns Char. A Char type is, in fact, a 32-bit integer whose numeric value is a Unicode code point, and they range from '\0' to '\Uffffffff'. Convert this to its code point with int(): int('A') returns 65, int('α') returns 945, so this takes two bytes.
The reverse also works: char(65) returns 'A', char(945) returns '\u3b1', 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 (0-9, A-F), or \U followed by eight hexadecimal digits. The function is_valid_char() can test whether a number returns an existing Unicode character: is_valid_char(0x3b1) returns true. The normal escape characters such as \t (tab), \n (newline), \', and so on also exist in...
Change the font size
Change margin width
Change background colour