gradle
8.5

# TextUtil

open class TextUtil(source)

### Deprecated

This class is only here to maintain binary compatibility with existing plugins.

Plugins should prefer external frameworks over this class.

#### Deprecated

Will be removed in Gradle 9.0.

## Constructors

TextUtil
Link copied to clipboard
constructor()

## Functions

camelToKebabCase
Link copied to clipboard
open fun camelToKebabCase(camelCase: String): String
containsWhitespace
Link copied to clipboard
open fun containsWhitespace(str: String): Boolean
Tells whether the specified string contains any whitespace characters.
convertLineSeparators
Link copied to clipboard
@Nullable
open fun convertLineSeparators(@Nullable str: String, sep: String): String
Converts all line separators in the specified string to the specified line separator.
convertLineSeparatorsToUnix
Link copied to clipboard
open fun convertLineSeparatorsToUnix(str: String): String
Converts all line separators in the specified non-null string to the Unix line separator `\n`.
escapeString
Link copied to clipboard
open fun escapeString(obj: Any): String
Escapes the toString() representation of `obj` for use in a literal string.
getPlatformLineSeparator
Link copied to clipboard
open fun getPlatformLineSeparator(): String
Returns the line separator for this platform.
getUnixLineSeparator
Link copied to clipboard
open fun getUnixLineSeparator(): String
Returns the line separator for Unix.
getWindowsLineSeparator
Link copied to clipboard
open fun getWindowsLineSeparator(): String
Returns the line separator for Windows.
indent
Link copied to clipboard
open fun indent(text: String, indent: String): String
Indents every line of `text` by `indent`.
minus
Link copied to clipboard
open fun minus(originalString: String, removeString: String): String
Same behavior as Groovy minus operator between Strings
normaliseFileAndLineSeparators
Link copied to clipboard
open fun normaliseFileAndLineSeparators(in: String): String
normaliseFileSeparators
Link copied to clipboard
open fun normaliseFileSeparators(path: String): String
Converts all native file separators in the specified string to '/'.
normaliseLineSeparators
Link copied to clipboard
@Nullable
open fun normaliseLineSeparators(@Nullable str: String): String
Converts all line separators in the specified nullable string to a single new line character (`\n`).
replaceLineSeparatorsOf
Link copied to clipboard
open fun replaceLineSeparatorsOf(string: CharSequence, bySeparator: String): String
Converts all line separators in the specified non-null CharSequence to the specified line separator.
shorterOf
Link copied to clipboard
open fun shorterOf(s1: String, s2: String): String
toLowerCaseLocaleSafe
Link copied to clipboard
open fun toLowerCaseLocaleSafe(s: String): String
This method should be used when making strings lowercase that could be affected by locale differences.
toPlatformLineSeparators
Link copied to clipboard
open fun toPlatformLineSeparators(str: String): String
Converts all line separators in the specified string to the platform's line separator.