Returns the last position of the specified character. @param token token @param ch character to be found @return position, or -1 if token is not found.
(final byte[] token, final int ch)
| 865 | * @return position, or {@code -1} if token is not found. |
| 866 | */ |
| 867 | public static int lastIndexOf(final byte[] token, final int ch) { |
| 868 | final int tl = token.length; |
| 869 | int p = -1; |
| 870 | if(ch <= 0x7F) { |
| 871 | for(int t = tl - 1; t >= 0; --t) { |
| 872 | if(token[t] == ch) return t; |
| 873 | } |
| 874 | } else { |
| 875 | for(int t = 0; t < tl; t += cl(token, t)) { |
| 876 | if(cp(token, t) == ch) p = t; |
| 877 | } |
| 878 | } |
| 879 | return p; |
| 880 | } |
| 881 | |
| 882 | /** |
| 883 | * Returns the position of the specified token. |
no test coverage detected