String (@NotNull String string, int from, @NotNull Int2IntFunction nextIntFun) { StringBuilder builder = new StringBuilder(); int nextInt = from; while (nextInt >= 0 && nextInt < string.length() && Character.isLetter(string.charAt(nextInt))) { builder.append(string.charAt(nextInt)); nextInt = nextIntFun.applyAsInt(nextInt); } return builder.toString(); }