int (@NotNull CharSequence text) { int nonSpace = 0; int len = text.length(); int offset = 0; while (offset < len) { char c = text.charAt(offset); if (!isWhiteSpace(c)) nonSpace++; offset++; } return nonSpace; }