/** * Find the nth occurrence of the given byte b in a UTF-8 encoded string * @param utf a byte array containing a UTF-8 encoded string * @param start starting offset * @param length the length of byte array * @param b the byte to find * @param n the desired occurrence of the given byte * @return position that nth occurrence of the given byte if exists; otherwise -1 */ public static int findNthByte(byte [] utf, int start, int length, byte b, int n) { int pos = -1; int nextStart = start; for (int i = 0; i < n; i++) { pos = findByte(utf, nextStart, length, b); if (pos < 0) { return pos; } nextStart = pos + 1; } return pos; }
/** * Find the nth occurrence of the given byte b in a UTF-8 encoded string * @param utf a byte array containing a UTF-8 encoded string * @param start starting offset * @param length the length of byte array * @param b the byte to find * @param n the desired occurrence of the given byte * @return position that nth occurrence of the given byte if exists; otherwise -1 */ public static int findNthByte(byte [] utf, int start, int length, byte b, int n) { int pos = -1; int nextStart = start; for (int i = 0; i < n; i++) { pos = findByte(utf, nextStart, length, b); if (pos < 0) { return pos; } nextStart = pos + 1; } return pos; }
/** * Find the nth occurrence of the given byte b in a UTF-8 encoded string * @param utf a byte array containing a UTF-8 encoded string * @param start starting offset * @param length the length of byte array * @param b the byte to find * @param n the desired occurrence of the given byte * @return position that nth occurrence of the given byte if exists; otherwise -1 */ public static int findNthByte(byte [] utf, int start, int length, byte b, int n) { int pos = -1; int nextStart = start; for (int i = 0; i < n; i++) { pos = findByte(utf, nextStart, length, b); if (pos < 0) { return pos; } nextStart = pos + 1; } return pos; }
/** * Find the nth occurrence of the given byte b in a UTF-8 encoded string * @param utf a byte array containing a UTF-8 encoded string * @param start starting offset * @param length the length of byte array * @param b the byte to find * @param n the desired occurrence of the given byte * @return position that nth occurrence of the given byte if exists; otherwise -1 */ public static int findNthByte(byte [] utf, int start, int length, byte b, int n) { int pos = -1; int nextStart = start; for (int i = 0; i < n; i++) { pos = findByte(utf, nextStart, length, b); if (pos < 0) { return pos; } nextStart = pos + 1; } return pos; }
/** * Find the nth occurrence of the given byte b in a UTF-8 encoded string * @param utf a byte array containing a UTF-8 encoded string * @param start starting offset * @param length the length of byte array * @param b the byte to find * @param n the desired occurrence of the given byte * @return position that nth occurrence of the given byte if exists; otherwise -1 */ public static int findNthByte(byte [] utf, int start, int length, byte b, int n) { int pos = -1; int nextStart = start; for (int i = 0; i < n; i++) { pos = findByte(utf, nextStart, length, b); if (pos < 0) { return pos; } nextStart = pos + 1; } return pos; }
/** * Find the nth occurrence of the given byte b in a UTF-8 encoded string * @param utf a byte array containing a UTF-8 encoded string * @param start starting offset * @param length the length of byte array * @param b the byte to find * @param n the desired occurrence of the given byte * @return position that nth occurrence of the given byte if exists; otherwise -1 */ public static int findNthByte(byte [] utf, int start, int length, byte b, int n) { int pos = -1; int nextStart = start; for (int i = 0; i < n; i++) { pos = findByte(utf, nextStart, length, b); if (pos < 0) { return pos; } nextStart = pos + 1; } return pos; }
/** * Find the nth occurrence of the given byte b in a UTF-8 encoded string * @param utf a byte array containing a UTF-8 encoded string * @param start starting offset * @param length the length of byte array * @param b the byte to find * @param n the desired occurrence of the given byte * @return position that nth occurrence of the given byte if exists; otherwise -1 */ public static int findNthByte(byte [] utf, int start, int length, byte b, int n) { int pos = -1; int nextStart = start; for (int i = 0; i < n; i++) { pos = findByte(utf, nextStart, length, b); if (pos < 0) { return pos; } nextStart = pos + 1; } return pos; }