@groovy.transform.CompileStatic abstract class GrailsStringUtils extends org.springframework.util.StringUtils
Extra methods for string manipulation
Constructor and description |
---|
GrailsStringUtils
() |
Type Params | Return Type | Name and description |
---|---|---|
|
static java.lang.String |
getFileBasename(java.lang.String path) Obtains the base name of a file excluding path and extension |
|
static boolean |
isBlank(java.lang.String str) Same as StringUtils#isEmpty(java.lang.Object) but trims the string for surrounding whitespace |
|
static boolean |
isNotBlank(java.lang.String str) Opposite of GrailsStringUtils.isBlank |
|
static boolean |
isNotEmpty(java.lang.String str) Opposite of GrailsStringUtils.isEmpty |
|
static java.lang.String |
substringAfter(java.lang.String str, java.lang.String token) Returns a substring after the given token |
|
static java.lang.String |
substringAfterLast(java.lang.String str, java.lang.String token) Returns a substring after the last occurrence of the given token |
|
static java.lang.String |
substringBefore(java.lang.String str, java.lang.String token) Returns a substring before the given token |
|
static java.lang.String |
substringBeforeLast(java.lang.String str, java.lang.String token) Returns a substring before the last occurance of the given token |
|
static boolean |
toBoolean(java.lang.String str) Converts a string to a boolean. |
|
static java.lang.String |
trimStart(java.lang.String str, java.lang.String start) Trims the start of the string |
Methods inherited from class | Name |
---|---|
class org.springframework.util.StringUtils |
org.springframework.util.StringUtils#containsWhitespace(java.lang.CharSequence), org.springframework.util.StringUtils#containsWhitespace(java.lang.String), org.springframework.util.StringUtils#uriDecode(java.lang.String, java.nio.charset.Charset), org.springframework.util.StringUtils#startsWithIgnoreCase(java.lang.String, java.lang.String), org.springframework.util.StringUtils#arrayToCommaDelimitedString([Ljava.lang.Object;), org.springframework.util.StringUtils#trimTrailingWhitespace(java.lang.String), org.springframework.util.StringUtils#trimTrailingCharacter(java.lang.String, char), org.springframework.util.StringUtils#countOccurrencesOf(java.lang.String, java.lang.String), org.springframework.util.StringUtils#quoteIfString(java.lang.Object), org.springframework.util.StringUtils#unqualify(java.lang.String, char), org.springframework.util.StringUtils#unqualify(java.lang.String), org.springframework.util.StringUtils#trimAllWhitespace(java.lang.String), org.springframework.util.StringUtils#getFilenameExtension(java.lang.String), org.springframework.util.StringUtils#stripFilenameExtension(java.lang.String), org.springframework.util.StringUtils#pathEquals(java.lang.String, java.lang.String), org.springframework.util.StringUtils#parseLocaleString(java.lang.String), org.springframework.util.StringUtils#parseTimeZoneString(java.lang.String), org.springframework.util.StringUtils#addStringToArray([Ljava.lang.String;, java.lang.String), org.springframework.util.StringUtils#concatenateStringArrays([Ljava.lang.String;, [Ljava.lang.String;), org.springframework.util.StringUtils#mergeStringArrays([Ljava.lang.String;, [Ljava.lang.String;), org.springframework.util.StringUtils#sortStringArray([Ljava.lang.String;), org.springframework.util.StringUtils#trimArrayElements([Ljava.lang.String;), org.springframework.util.StringUtils#removeDuplicateStrings([Ljava.lang.String;), org.springframework.util.StringUtils#splitArrayElementsIntoProperties([Ljava.lang.String;, java.lang.String), org.springframework.util.StringUtils#splitArrayElementsIntoProperties([Ljava.lang.String;, java.lang.String, java.lang.String), org.springframework.util.StringUtils#commaDelimitedListToStringArray(java.lang.String), org.springframework.util.StringUtils#commaDelimitedListToSet(java.lang.String), org.springframework.util.StringUtils#collectionToCommaDelimitedString(java.util.Collection), org.springframework.util.StringUtils#substringMatch(java.lang.CharSequence, int, java.lang.CharSequence), org.springframework.util.StringUtils#matchesCharacter(java.lang.String, char), org.springframework.util.StringUtils#trimWhitespace(java.lang.String), org.springframework.util.StringUtils#arrayToDelimitedString([Ljava.lang.Object;, java.lang.String), org.springframework.util.StringUtils#hasLength(java.lang.String), org.springframework.util.StringUtils#hasLength(java.lang.CharSequence), org.springframework.util.StringUtils#tokenizeToStringArray(java.lang.String, java.lang.String, boolean, boolean), org.springframework.util.StringUtils#tokenizeToStringArray(java.lang.String, java.lang.String), org.springframework.util.StringUtils#trimLeadingWhitespace(java.lang.String), org.springframework.util.StringUtils#trimLeadingCharacter(java.lang.String, char), org.springframework.util.StringUtils#hasText(java.lang.String), org.springframework.util.StringUtils#hasText(java.lang.CharSequence), org.springframework.util.StringUtils#collectionToDelimitedString(java.util.Collection, java.lang.String, java.lang.String, java.lang.String), org.springframework.util.StringUtils#collectionToDelimitedString(java.util.Collection, java.lang.String), org.springframework.util.StringUtils#delimitedListToStringArray(java.lang.String, java.lang.String, java.lang.String), org.springframework.util.StringUtils#delimitedListToStringArray(java.lang.String, java.lang.String), org.springframework.util.StringUtils#deleteAny(java.lang.String, java.lang.String), org.springframework.util.StringUtils#cleanPath(java.lang.String), org.springframework.util.StringUtils#applyRelativePath(java.lang.String, java.lang.String), org.springframework.util.StringUtils#capitalize(java.lang.String), org.springframework.util.StringUtils#toStringArray(java.util.Enumeration), org.springframework.util.StringUtils#toStringArray(java.util.Collection), org.springframework.util.StringUtils#uncapitalize(java.lang.String), org.springframework.util.StringUtils#getFilename(java.lang.String), org.springframework.util.StringUtils#endsWithIgnoreCase(java.lang.String, java.lang.String), org.springframework.util.StringUtils#isEmpty(java.lang.Object), org.springframework.util.StringUtils#replace(java.lang.String, java.lang.String, java.lang.String), org.springframework.util.StringUtils#split(java.lang.String, java.lang.String), org.springframework.util.StringUtils#delete(java.lang.String, java.lang.String), org.springframework.util.StringUtils#quote(java.lang.String), org.springframework.util.StringUtils#toLanguageTag(java.util.Locale), org.springframework.util.StringUtils#parseLocale(java.lang.String), org.springframework.util.StringUtils#wait(long, int), org.springframework.util.StringUtils#wait(long), org.springframework.util.StringUtils#wait(), org.springframework.util.StringUtils#equals(java.lang.Object), org.springframework.util.StringUtils#toString(), org.springframework.util.StringUtils#hashCode(), org.springframework.util.StringUtils#getClass(), org.springframework.util.StringUtils#notify(), org.springframework.util.StringUtils#notifyAll() |
Obtains the base name of a file excluding path and extension
path
- The pathSame as StringUtils#isEmpty(java.lang.Object) but trims the string for surrounding whitespace
Opposite of GrailsStringUtils.isBlank
Opposite of GrailsStringUtils.isEmpty
Returns a substring after the given token GrailsStringUtils.substringAfter(null, *) = null GrailsStringUtils.substringAfter("", *) = "" GrailsStringUtils.substringAfter(*, null) = "" GrailsStringUtils.substringAfter("abc", "a") = "bc" GrailsStringUtils.substringAfter("abcba", "b") = "cba" GrailsStringUtils.substringAfter("abc", "c") = "" GrailsStringUtils.substringAfter("abc", "d") = "" GrailsStringUtils.substringAfter("abc", "") = "abc"
str
- The string to apply the substringtoken
- The token to matchReturns a substring after the last occurrence of the given token GrailsStringUtils.substringAfter(null, *) = null GrailsStringUtils.substringAfter("", *) = "" GrailsStringUtils.substringAfter(*, null) = "" GrailsStringUtils.substringAfter("abc", "a") = "bc" GrailsStringUtils.substringAfter("abcba", "b") = "cba" GrailsStringUtils.substringAfter("abc", "c") = "" GrailsStringUtils.substringAfter("abc", "d") = "" GrailsStringUtils.substringAfter("abc", "") = "abc"
str
- The string to apply the substringtoken
- The token to matchReturns a substring before the given token GrailsStringUtils.substringBefore(null, *) = null GrailsStringUtils.substringBefore("", *) = "" GrailsStringUtils.substringBefore("abc", "a") = "" GrailsStringUtils.substringBefore("abcba", "b") = "a" GrailsStringUtils.substringBefore("abc", "c") = "ab" GrailsStringUtils.substringBefore("abc", "d") = "abc" GrailsStringUtils.substringBefore("abc", "") = "" GrailsStringUtils.substringBefore("abc", null) = "abc"
str
- The string to apply the substringtoken
- The token to matchReturns a substring before the last occurance of the given token GrailsStringUtils.substringBefore(null, *) = null GrailsStringUtils.substringBefore("", *) = "" GrailsStringUtils.substringBefore("abc", "a") = "" GrailsStringUtils.substringBefore("abcba", "b") = "a" GrailsStringUtils.substringBefore("abc", "c") = "ab" GrailsStringUtils.substringBefore("abc", "d") = "abc" GrailsStringUtils.substringBefore("abc", "") = "" GrailsStringUtils.substringBefore("abc", null) = "abc"
str
- The string to apply the substringtoken
- The token to matchConverts a string to a boolean. The values 'true', 'on', 'yes' and '1' result in true being returned, otherwise false is returned
str
- The stringTrims the start of the string
str
- The string to trimstart
- The start to trim