We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6a2c992 commit 75be10fCopy full SHA for 75be10f
src/main/java/org/variantsync/diffdetective/util/StringUtils.java
@@ -48,4 +48,17 @@ public static String prettyPrintNestedCollections(final Collection<?> collection
48
public static String clamp(int maxlen, String s) {
49
return s.substring(0, Math.min(s.length(), maxlen));
50
}
51
+
52
+ /**
53
+ * @return the longest prefix of the given string that contains only of whitespace
54
+ */
55
+ public static String getLeadingWhitespace(String s) {
56
+ if (s == null) return null;
57
+ if (s.isEmpty()) return "";
58
+ int i = 0;
59
+ while (i < s.length() && Character.isWhitespace(s.charAt(i))) {
60
+ ++i;
61
+ }
62
+ return s.substring(0, i);
63
64
0 commit comments