Class Strings
java.lang.Object
software.xdev.testcontainers.imagebuilder.jgit.ignore.internal.Strings
Various
String related utility methods, written mostly to avoid generation of new String objects (e.g. via
splitting Strings etc).-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic PatternconvertGlob(String pattern) Conversion from glob to Java regex following two sources: Git Glob Man Page org.eclipse.jgit.fnmatch.FileNameMatcher.java Seems that there are various ways to define what "glob" can be.static booleanisDirectoryPattern(String pattern) Check if pattern is a directory pattern ending with a path separatorSplits given string to substrings by given separatorstatic StringstripTrailing(String pattern, char c) Strip trailing charactersstatic StringstripTrailingWhitespace(String pattern) Strip trailing whitespace characters
-
Field Details
-
PATH_SEPARATOR
public static final char PATH_SEPARATOR- See Also:
-
-
Method Details
-
stripTrailing
Strip trailing characters- Parameters:
pattern- non nullc- character to remove- Returns:
- new string with all trailing characters removed
-
stripTrailingWhitespace
Strip trailing whitespace characters- Parameters:
pattern- non null- Returns:
- new string with all trailing whitespace removed
-
isDirectoryPattern
Check if pattern is a directory pattern ending with a path separator- Parameters:
pattern- non null- Returns:
trueif the last character, which is not whitespace, is a path separator
-
split
Splits given string to substrings by given separator- Parameters:
pattern- non nullslash- separator char- Returns:
- list of substrings
-
convertGlob
Conversion from glob to Java regex following two sources:- Git Glob Man Page
- org.eclipse.jgit.fnmatch.FileNameMatcher.java Seems that there are various ways to define what "glob" can be.
- Parameters:
pattern- non null pattern- Returns:
- Java regex pattern corresponding to given glob pattern
- Throws:
InvalidPatternException- if pattern is invalid
-