Konloch Software

Fast String Utils

Published 02/20/2023 Updated 03/17/2023

FastStringUtils is an easy-to-use zero dependency collection of very fast String utility functions for Java.

What Does It Do?

  • Small Java Library that provides static functions for dealing with Java Strings.
  • By default, the Java String.split function is regex based. As a general rule, I avoid using it in all of my projects. Instead, I opt for using this library to replace that function.

Links

Requirements

  • Java 8 or greater

How To Integrate as a Dependency

Add the following to your pom.xml as a maven dependency, or just download the latest release and import it with your IDE.

<dependency>
  <groupId>com.konloch</groupId>
  <artifactId>FastStringUtils</artifactId>
  <version>1.3.0</version>
</dependency>

How To Use

This is a very small library and only contains a handful of functions.

Splitting a String with a supplied separator.

By default, the Java String.split function is regex based. As a general rule, I avoid using it in all of my projects. Instead, I opt for using this library to replace that function.

//split the string using the space character as a separator
String[] simpleSplitExample = FastStringUtils.split("Split Example", " ");

//split the string using the space character as a separator, with a maximum search limit of 2
String[] limiterSplitExample = FastStringUtils.split("Split Example With A Limit ", " ", 2);

//split the string using the space character as a separator, with a maximum search limit of 2, and preserve the separator
String[] limiterSplitExamplePreseveSeparator = FastStringUtils.split("Split Example With A Limit ", " ", 2, true);

Check the value of a String

These functions are used to do fast non-strict checks to see if the string can represent specific types.

boolean isNull = FastStringUtils.isNull("null");
boolean isBoolean = FastStringUtils.isBoolean("false");
boolean isInteger = FastStringUtils.isInteger("1");
boolean isDouble = FastStringUtils.isDouble("1.0D");
boolean isFloat = FastStringUtils.isFloat("1.0F");

Latest Updates

Fast String Utils v1.3.0

This has been heavily tested but please feel free to report any issues found.

To add it as a maven dependency:

<dependency> 
 <groupId>com.konloch</groupId> 
 <artifactId>FastStringUtils</artifactId>.
Read More

Fast String Utils v1.2.0

This has been heavily tested but please feel free to report any issues found.

To add it as a maven dependency:

<dependency> 
 <groupId>com.konloch</groupId> 
 <artifactId>FastStringUtils</artifactId>.
Read More