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
- Host: GitHub
- URL: https://github.com/marschall/charsequences
- Owner: marschall
- Created: 2016-12-29T21:46:48.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-09-23T07:33:37.000Z (over 4 years ago)
- Last Synced: 2025-01-16T02:45:07.851Z (4 months ago)
- Topics: charsequence, java, string
- Language: Java
- Size: 969 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
CharSequences [](https://maven-badges.herokuapp.com/maven-central/com.github.marschall/charsequences) [](https://www.javadoc.io/doc/com.github.marschall/charsequences) [](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.