private static int findEndOfLabel(String nTriplesLiteral){
  boolean previousWasBackslash=false;
  for (int i=1; i < nTriplesLiteral.length(); i++) {
    char c=nTriplesLiteral.charAt(i);
    if (c == '"' && !previousWasBackslash) {
      return i;
    }
 else     if (c == '\\' && !previousWasBackslash) {
      previousWasBackslash=true;
    }
 else     if (previousWasBackslash) {
      previousWasBackslash=false;
    }
  }
  return -1;
}

private static int findEndOfLabel ( String nTriplesLiteral ) { boolean previousWasBackslash = false ; for ( int i = 1 ; i < nTriplesLiteral . length ( ) ; i ++ ) { char c = nTriplesLiteral . charAt ( i ) ; if ( c == '"' && ! previousWasBackslash ) { return i ; } else if ( c == '\\' && ! previousWasBackslash ) { previousWasBackslash = true ; } else if ( previousWasBackslash ) { previousWasBackslash = false ; } } return - 1 ; }
finds the end of the label in a literal string . this method takes into account that characters can be escaped using backslashes .
