blob: 3666f962ce3edb1383b219fad36695090c801ded (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
namespace Eva {
private string array_to_string(uchar* array, ulong len) {
string ret = "";
for(ulong i = 0; i < len; ++i) {
if(array[i] == 0)
break;
string buf = string.nfill(6, 0);
((unichar)array[i]).to_utf8(buf);
ret += buf;
}
return ret;
}
private char[]? string_to_array(string str) {
char[] ret = new char[str.len()];
int index = 0;
for(unowned string rest = str; rest.length > 0; rest = rest.next_char()) {
unichar c = rest.get_char();
if(c > 255)
return null;
ret[index++] = (char)c;
}
return ret;
}
private List string_to_list(string str) {
List ret = new List();
for(unowned string rest = str; rest.length > 0; rest = rest.next_char()) {
unichar c = rest.get_char();
ret.list.add(new UInt(c));
}
return ret;
}
}
|