ninio-string/src/main/java/com/davfx/ninio/string/StringHandler.java
private static final int find(boolean skipBlocks, String s, char toFind, int from) {
		int open = 0;
		boolean escaping = false;
		for (int i = from; i < s.length(); i++) {
			if (escaping) {
				escaping = false;
				continue;
			}
			char c = s.charAt(i);
			if (c == '\\') {
				escaping = true;
				continue;
			}
			if ((open == 0) && (c == toFind)) {
				return i;
			} else if (skipBlocks && (c == '{')) {
				open++;
			} else if (skipBlocks && (c == '}')) {
				open--;
			}
		}
		return -1;
	}
private static final int find(boolean skipBlocks, String s, char toFind, int from) {
		int open = 0;
		boolean escaping = false;
		for (int i = from; i < s.length(); i++) {
			if (escaping) {
				escaping = false;
				continue;
			}
			char c = s.charAt(i);
			if (c == '\\') {
				escaping = true;
				continue;
			}
			if ((open == 0) && (c == toFind)) {
				return i;
			} else if (skipBlocks && (c == '{')) {
				open++;
			} else if (skipBlocks && (c == '}')) {
				open--;
			}
		}
		return -1;
	}
private static final int find ( boolean skipBlocks , String s , char toFind , int from ) { int open = 0 ; boolean escaping = false ; for ( int i = from ; i < s . length ( ) ; i ++ ) { if ( escaping ) { escaping = false ; continue ; } char c = s . charAt ( i ) ; if ( c == ' ' ) { escaping = true ; continue ; } if ( ( open == 0 ) && ( c == toFind ) ) { return i ; } else if ( skipBlocks && ( c == ' ' ) ) { open ++ ; } else if ( skipBlocks && ( c == ' ' ) ) { open -- ; } } return - 1 ; }
Beware, with the current algorithm, this function cannot find '\'
Beware with the current algorithm this function cannot find \