private static int skipWhiteSpaces(int offset, @NotNull CharSequence documentText) { while (offset < documentText.length() && StringUtil.isWhiteSpace(documentText.charAt(offset))) { offset += 1; } return Math.min(documentText.length() - 1, offset); } }
public boolean prefixMatches(@NotNull String prefix, @NotNull String variant) { boolean matches = new CamelHumpMatcher(prefix, false).prefixMatches(variant.replace(' ', '_')); if (matches && isWhiteSpace(prefix.charAt(prefix.length() - 1))) { return startsWithIgnoreCase(variant, prefix); } return matches; } }
@Nullable public String getBuildFlags() { GoFileStub stub = getStub(); if (stub != null) { return stub.getBuildFlags(); } // https://code.google.com/p/go/source/browse/src/pkg/go/build/build.go?r=2449e85a115014c3d9251f86d499e5808141e6bc#790 Collection<String> buildFlags = ContainerUtil.newArrayList(); int buildFlagLength = GoConstants.BUILD_FLAG.length(); for (PsiComment comment : getCommentsToConsider(this)) { String commentText = StringUtil.trimStart(comment.getText(), "//").trim(); if (commentText.startsWith(GoConstants.BUILD_FLAG) && commentText.length() > buildFlagLength && StringUtil.isWhiteSpace(commentText.charAt(buildFlagLength))) { ContainerUtil.addIfNotNull(buildFlags, StringUtil.nullize(commentText.substring(buildFlagLength).trim(), true)); } } return !buildFlags.isEmpty() ? StringUtil.join(buildFlags, "|") : null; }
@Contract(pure = true) public static int stringHashCodeIgnoreWhitespaces(char[] chars, int from, int to) { int h = 0; for (int off = from; off < to; off++) { char c = chars[off]; if (!isWhiteSpace(c)) { h = 31 * h + c; } } return h; }
@Contract(pure = true) public static int stringHashCodeIgnoreWhitespaces(@NotNull CharSequence chars, int from, int to) { int h = 0; for (int off = from; off < to; off++) { char c = chars.charAt(off); if (!isWhiteSpace(c)) { h = 31 * h + c; } } return h; }
public boolean prefixMatches(@NotNull String prefix, @NotNull String variant) { boolean matches = new CamelHumpMatcher(prefix, false).prefixMatches(variant.replace(' ', '_')); if (matches && isWhiteSpace(prefix.charAt(prefix.length() - 1))) { return startsWithIgnoreCase(variant, prefix); } return matches; } }
while (index1 != len1 && isWhiteSpace(s1.charAt(index1))) { skipped = true; index1++; while (index2 != len2 && isWhiteSpace(s2.charAt(index2))) { skipped = true; index2++; if (!isWhiteSpace(s1.charAt(index1))) return false; if (!isWhiteSpace(s2.charAt(index2))) return false;