An open API service indexing awesome lists of open source software.

https://github.com/marschall/charsequences

Utility methods for dealing with java.lang.CharSequence
https://github.com/marschall/charsequences

charsequence java string

Last synced: 3 months ago
JSON representation

Utility methods for dealing with java.lang.CharSequence

Awesome Lists containing this project

README

        

CharSequences [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.marschall/charsequences/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.marschall/charsequences) [![Javadocs](https://www.javadoc.io/badge/com.github.marschall/charsequences.svg)](https://www.javadoc.io/doc/com.github.marschall/charsequences) [![Build Status](https://travis-ci.org/marschall/charsequences.svg?branch=master)](https://travis-ci.org/marschall/charsequences)
=============

Utility methods for dealing with `java.lang.CharSequence`.

```xml

com.github.marschall
charsequences
0.8.0

```

When dealing with [CharSequence](https://docs.oracle.com/javase/8/docs/api/java/lang/CharSequence.html) instead of [String](https://docs.oracle.com/javase/8/docs/api/java/lang/String.html) many convince methods are not available. While you could simply call [toString()](https://docs.oracle.com/javase/9/docs/api/java/lang/CharSequence.html#toString--) on the CharSequence this would defeat the purpose of using a CharSequence. This is project contains implementations of some of them.

- [indexOf(char)](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#indexOf(int))
- [indexOf(char, int)](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#indexOf(int,int))
- [startsWith(CharSequence)](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#startsWith(java.lang.String))
- [trim()](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#trim())
- [Integer.parseInt(String)](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Integer.html#parseInt(java.lang.String)), no longer needed in Java 9 but still faster
- [Long.parseLong(String)](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Long.html#parseLong(java.lang.String)), no longer needed in Java 9 but still faster
- [String.split(String)](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#split(java.lang.String)), limited, only a single character is allowed, not a full regex
- [UUID.fromString(String)](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/UUID.html#fromString(java.lang.String)), no intermediary allocation
- an empty implementation of `CharSequence`

They avoid allocation where possible, check out the [Javadoc](http://www.javadoc.io/doc/com.github.marschall/charsequences) for more information.