int (int start_offset, CharSequence text) { int current_offset = start_offset; int text_length = text.length(); while (current_offset < text_length) { char current_char = text.charAt(current_offset); if (current_char != ' ' && current_char != '\t' && current_char != '\n') break; current_offset += 1; } return current_offset; }