All Downloads are FREE. Search and download functionalities are using the official Maven repository.

java.lang.jtransc.JTranscStrings Maven / Gradle / Ivy

Go to download

JVM AOT compiler currently generating JavaScript, C++, Haxe, with initial focus on Kotlin and games.

There is a newer version: 0.6.8
Show newest version
package java.lang.jtransc;

public class JTranscStrings {
	static public char[] getData(String str) {
		return str.value;
	}

	static public boolean equals(char[] a, int aoffset, char[] b, int boffset, int len) {
		for (int n = 0; n < len; n++) if (a[aoffset + n] != b[boffset + n]) return false;
		return true;
	}

	static public int indexOf(char[] base, int offset, int haystack) {
		int end = base.length;
		for (int n = offset; n < end; n++) if (base[n] == haystack) return n;
		return -1;
	}

	static public int lastIndexOf(char[] base, int offset, int haystack) {
		int start = Math.min(offset, base.length - 1);
		for (int n = start; n >= 0; n--) if (base[n] == haystack) return n;
		return -1;
	}

	static public int indexOf(char[] base, int offset, char[] haystack) {
		int end = base.length - haystack.length;
		for (int n = offset; n < end; n++) if (JTranscStrings.equals(base, n, haystack, 0, haystack.length)) return n;
		return -1;
	}

	static public int lastIndexOf(char[] base, int offset, char[] haystack) {
		int start = Math.min(offset, base.length - haystack.length);
		for (int n = start; n >= 0; n--) if (JTranscStrings.equals(base, n, haystack, 0, haystack.length)) return n;
		return -1;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy