package jazz.lang; /////////////////////////////////////////////////////////////////////////////// // // Strings // /////////////////////////////////////////////////////////////////////////////// public native final class String implements Comparable { public native equals(s: String): boolean = "%stringEqual"; public native length(): int = "int java.lang.String.length()"; public native charAt(k: int): int = "char java.lang.String.charAt(int)"; public native equalsIgnoreCase(s: String): boolean = "boolean java.lang.String.equalsIgnoreCase(java.lang.String)"; public native compareTo(s: String): int = "int java.lang.String.compareTo(java.lang.String)"; public native regionMatches(toffset: int, other: String, ooffset: int, len: int): boolean = "boolean java.lang.String.regionMatches(int,java.lang.String,int,int)"; public native startsWith(prefix: String): boolean = "boolean java.lang.String.startsWith(java.lang.String)"; public native endsWith(suffix: String): boolean = "boolean java.lang.String.endsWith(java.lang.String)"; public native indexOf(str: String, fromIndex: int): int = "int java.lang.String.indexOf(java.lang.String,int)"; public native lastIndexOf(str: String, fromIndex: int): int = "int java.lang.String.lastIndexOf(java.lang.String,int)"; public native substring(beginIndex: int, endIndex: int): String = "java.lang.String java.lang.String.substring(int,int)"; public native concat(str: String): String = "java.lang.String java.lang.String.concat(java.lang.String)"; public native replace(oldChar: int, newChar: int): String = "java.lang.String java.lang.String.replace(char, char)"; public native toLowerCase(): String = "java.lang.String java.lang.String.toLowerCase()"; public native toUpperCase(): String = "java.lang.String java.lang.String.toUpperCase()"; public native trim(): String = "java.lang.String java.lang.String.trim()"; public native split(delim: String): (int, String[]) = "%stringSplit"; } /////////////////////////////////////////////////////////////////////////////// // // Implementation // /////////////////////////////////////////////////////////////////////////////// Builtin.(<)(x@String, y@String) = (x.compareTo(y) < 0); Builtin.(>)(x@String, y@String) = (x.compareTo(y) > 0); Builtin.(<=)(x@String, y@String) = (x.compareTo(y) <= 0); Builtin.(>=)(x@String, y@String) = (x.compareTo(y) >= 0); Builtin.(==)(x@String, y@String) = x.equals(y);