1.1 --- a/emul/src/main/java/java/lang/String.java Mon Dec 03 00:03:40 2012 +0100
1.2 +++ b/emul/src/main/java/java/lang/String.java Tue Dec 04 11:21:10 2012 +0100
1.3 @@ -1691,6 +1691,10 @@
1.4 * than or equal to <code>fromIndex</code>, or <code>-1</code>
1.5 * if the character does not occur before that point.
1.6 */
1.7 + @JavaScriptBody(args = { "self", "ch", "from" }, body =
1.8 + "if (typeof ch === 'number') ch = String.fromCharCode(ch);\n" +
1.9 + "return self.toString().lastIndexOf(ch, from);"
1.10 + )
1.11 public int lastIndexOf(int ch, int fromIndex) {
1.12 if (ch < Character.MIN_SUPPLEMENTARY_CODE_POINT) {
1.13 // handle most cases here (ch is a BMP code point or a
1.14 @@ -1855,6 +1859,9 @@
1.15 * searching backward from the specified index,
1.16 * or {@code -1} if there is no such occurrence.
1.17 */
1.18 + @JavaScriptBody(args = { "self", "s", "from" }, body =
1.19 + "return self.toString().lastIndexOf(s.toString(), from);"
1.20 + )
1.21 public int lastIndexOf(String str, int fromIndex) {
1.22 return lastIndexOf(toCharArray(), offset(), length(), str.toCharArray(), str.offset(), str.length(), fromIndex);
1.23 }