Rename REAMDE to README.md
[nit.git] / tests / utf_test.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # This file is free software, which comes along with NIT. This software is
4 # distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
5 # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
6 # PARTICULAR PURPOSE. You can modify it is you want, provided this header
7 # is kept unaltered, and a notification of the changes is added.
8 # You are allowed to redistribute it and sell it, alone or is a part of
9 # another product.
10
11 import standard
12 intrude import string_experimentations::utf8
13
14 var s = "aàハ𐍆".as(FlatString)
15 assert s.index[0].code_point == 97
16 assert s.index[1].code_point == 224
17 assert s.index[2].code_point == 12495
18 assert s.index[3].code_point == 66374
19
20 var str = "ハaロЖー𐍃aδΈ–η•Œ α“€ . α“‚ A,𐍆 aζ—₯本Aθͺžaです".as(FlatString)
21
22 print str.length
23
24 print str.reversed
25
26 str.output
27
28 print ""
29
30 var x = str.substring(4,4).as(FlatString)
31
32 print x
33
34 for i in [0..x.length[ do
35 print x.index[i + x.index_from].code_point.to_hex
36 end
37
38 print str.to_upper
39
40 print str.to_lower
41
42 print str * 2