#.require. jvm namespace Test class Test def main is shared s as String = '' assert not s.length s = 'aoeu' assert 'aoeu'.length assert s.length==4 assert 'aoeu'=='aoeu' assert s=='aoeu' assert s<>'asdf' assert s.equals('aoeu') # assert s.getHashCode<>0 # clr method name assert s.hashCode<>0 # java method s = "aoeu" # double quotes assert 'aoeu'.length==4 #assert '\a'.length==1 # illegal escape chars in java #assert '\b'.length==1 #assert '\f'.length==1 assert '\n'.length==1 assert '\t'.length==1 assert '\\'.length==1 assert '\r'.length==1 assert '\0'.length==1 assert '\\t'.length==2 assert '\\t'[1]=='t' assert '\\t'[1]==c't' # concat assert 'a' + 'b' == 'ab' assert 'a' + '' == 'a' assert 'a' + 'b' + 'c' == 'abc' # try some methods assert 'abc'.indexOf('b')==1 assert 'abc'.indexOf('d')==-1 assert 'abc'.endsWith('c') # comparisons to chars assert 'x'==c'x' assert c'x'=='x' assert '\0'==c'\0' assert '\0'==String.valueOf(c'\0') # += s = 'x' s += 'y' assert s=='xy' # concat with valueOf(char) - toString not available on char s = 'aoeu' #s = s[0].toString + 'b' s = String.valueOf(s[0]) + 'b' assert s=='ab' # chars assert 'a'[0] == c'a' assert '"'[0] == c'"' assert "'"[0] == c"'" # backslashes assert 'cobra\'s lair' == "cobra's lair" assert '"' == "\"" assert '\'' == "'" assert '\''[0] == c"'" assert "\""[0] == c'"'