Skip to content

petromir/strings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Strings

The idea of this library is to fulfill only one gap - missing JDK String manipulations and checks. Yes, I could use commons-lang3, but I got tired of neverending CVEs mainly caused by unrelated to String manipulations. So this library starts small, mainly with operations which I used in the last 15 years of enterprise development (very few)

Warning

Under active development 🚧

Features

  • Null-safe operations – All methods handle null inputs gracefully without throwing exceptions.
  • Empty checks – Check whether a character sequence is empty or not.
  • Blank checks – Determine if a string contains only whitespace characters.
  • Capitalization – Convert the first character of a string to uppercase while preserving the rest.

Requirements

Java 25

Usage

Add to your project

<dependencies>
    <dependency>
        <groupId>com.petromirdzhunev.libs</groupId>
        <artifactId>strings</artifactId>
    </dependency>
</dependencies>

Code

import com.petromirdzhunev.strings.Strings;

public class Example {
    public static void main(String[] args) {
        // Empty checks
        Strings.isEmpty(null);        // true
        Strings.isEmpty("");          // true
        Strings.isEmpty("hello");     // false
        Strings.isNotEmpty("hello");  // true

        // Blank checks
        Strings.isBlank(null);        // true
        Strings.isBlank("");          // true
        Strings.isBlank("   ");       // true
        Strings.isBlank("hello");     // false

        // Capitalization
        Strings.capitalize("hello");  // "Hello"
        Strings.capitalize("Hello");  // "Hello"
        Strings.capitalize(null);     // null
	    Strings.capitalize("éhello");  // Éhello
    }
}

Development

Prerequisites

  1. Install SDKMAN
  2. Initialize SDKMAN environment
sdk env install

Check .sdkmanrc for all the tools installed with this command.

Build and publish SNAPSHOT versions to local repository

Change the version by adding a -SNAPSHOT suffix in the pom.xml file and then execute:

 mvnd -B clean install

Pointing to a SNAPSHOT version

<dependencies>
    <dependency>
        <groupId>com.petromirdzhunev.lib</groupId>
        <artifactId>strings</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </dependency>
</dependencies>

Support my work

Buy Me A Ko-fi Buy Me A Coffee GitHub Sponsor

About

Zero dependency String manipulation library

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages