groovy-string-extensions

A (very small) collection of Groovy (v2.0+) extensions for String and GString.

License

License

Categories

Categories

Groovy Languages
GroupId

GroupId

org.venutolo
ArtifactId

ArtifactId

groovy-string-extensions
Last Version

Last Version

0.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

groovy-string-extensions
A (very small) collection of Groovy (v2.0+) extensions for String and GString.
Project URL

Project URL

https://github.com/rvenutolo/groovy-string-extensions
Source Code Management

Source Code Management

https://github.com/rvenutolo/groovy-string-extensions

Download groovy-string-extensions

How to add to project

<!-- https://jarcasting.com/artifacts/org.venutolo/groovy-string-extensions/ -->
<dependency>
    <groupId>org.venutolo</groupId>
    <artifactId>groovy-string-extensions</artifactId>
    <version>0.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.venutolo/groovy-string-extensions/
implementation 'org.venutolo:groovy-string-extensions:0.1.0'
// https://jarcasting.com/artifacts/org.venutolo/groovy-string-extensions/
implementation ("org.venutolo:groovy-string-extensions:0.1.0")
'org.venutolo:groovy-string-extensions:jar:0.1.0'
<dependency org="org.venutolo" name="groovy-string-extensions" rev="0.1.0">
  <artifact name="groovy-string-extensions" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.venutolo', module='groovy-string-extensions', version='0.1.0')
)
libraryDependencies += "org.venutolo" % "groovy-string-extensions" % "0.1.0"
[org.venutolo/groovy-string-extensions "0.1.0"]

Dependencies

provided (1)

Group / Artifact Type Version
org.codehaus.groovy : groovy-all jar 2.4.7

test (1)

Group / Artifact Type Version
org.spockframework : spock-core jar 1.0-groovy-2.4

Project Modules

There are no modules declared in this project.

groovy-string-extensions

Build Status Coverage Status Quality Gate Dependency Status Dependency Status Dependencies

Maven Central GitHub release Maven Site Groovydoc

License Sputnik

A (very small) collection of Groovy (v2.0+) extensions for String and GString.


Maven:

<dependency>
    <groupId>org.venutolo</groupId>
    <artifactId>groovy-string-extensions</artifactId>
    <version>0.1.0</version>
</dependency>

Gradle:

compile 'org.venutolo:groovy-string-extensions:0.1.0'

Extensions Methods

Note: The GString methods do not modify the GString instance, and instead return a separate GString instance. The GString methods also do not modify the embedded values.

.joinLines()

static String joinLines(String self)
static GString joinLines(GString self)

Provides a method to trim leading and trailing whitespace and join multiple with a single space.

Example:

String s = '''
    This is a multi-line String
    that I want to join into one
    single line.
'''

assert s.joinLines() == 'This is a multi-line String that I want to join into one single line.'

.trimAndCollapseWhitespace()

static String trimAndCollapseWhitespace(String self)
static String trimAndCollapseWhitespace(GString self)

Provides a method to trim leading and trailing whitespace and collapse multiple whitespace characters to one single space.

Example:

GString query = """
    SELECT *
    FROM   cities
    WHERE  country = ${country}
    AND    region  = ${region}
"""

assert query.trimAndCollapseWhitespace() == "SELECT * FROM cities WHERE country = ${country} AND region = ${region}"

Make Release

./mvnw -B release:clean release:prepare release:perform

Update Maven Wrapper

Use Maven Wrapper plugin

mvn -N io.takari:maven:wrapper -Dmaven=3.5.0

Download latest scripts

wget https://raw.githubusercontent.com/takari/maven-wrapper/master/mvnw
wget https://raw.githubusercontent.com/takari/maven-wrapper/master/mvnw.cmd

Versions

Version
0.1.0