awtk/tests/fscripts/demo_str3.fs

13 lines
346 B
Forth
Raw Normal View History

2022-08-23 11:21:48 +08:00
var a="致远电子"
2021-07-19 18:32:35 +08:00
assert(ulen(a) == 4);
assert(ulen(a+"abc") == 7);
assert(usubstr(a) == '致远电子');
assert(usubstr(a,0) == '致远电子');
assert(usubstr(a,0,1) == '致');
assert(usubstr(a,0,-1) == '致远电');
assert(usubstr(a,-2,-1) == '电');
assert(usubstr(a, -3) == '远电子');
assert(usubstr(a, -3, ulen(a)) == '远电子');