mirror of
https://github.com/shekhargulati/strman-java.git
synced 2026-10-30 21:37:28 +00:00
Updated documentation to version 0.3.0
This commit is contained in:
@@ -26,6 +26,8 @@ Gradle users can add following to their build.gradle file.
|
|||||||
compile(group: 'com.shekhargulati', name: 'strman', version: '0.3.0')
|
compile(group: 'com.shekhargulati', name: 'strman', version: '0.3.0')
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To learn what we added in the latest version please refer to `./changelog.md`.
|
||||||
|
|
||||||
## Available Functions
|
## Available Functions
|
||||||
|
|
||||||
These are the available functions in current version of library:
|
These are the available functions in current version of library:
|
||||||
@@ -80,6 +82,16 @@ chars("title")
|
|||||||
// result => ["t", "i", "t", "l", "e"]
|
// result => ["t", "i", "t", "l", "e"]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## charsCount
|
||||||
|
|
||||||
|
Counts the number of occurrences of each character in the string
|
||||||
|
|
||||||
|
```java
|
||||||
|
import static strman.Strman.charsCount
|
||||||
|
charsCount("abca")
|
||||||
|
// result => Map(("a",2),("b",1),("c",1))
|
||||||
|
```
|
||||||
|
|
||||||
## collapseWhitespace
|
## collapseWhitespace
|
||||||
|
|
||||||
Replace consecutive whitespace characters with a single space.
|
Replace consecutive whitespace characters with a single space.
|
||||||
@@ -496,6 +508,17 @@ transliterate("fóõ bár")
|
|||||||
// result => "foo bar"
|
// result => "foo bar"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## trimEnd
|
||||||
|
|
||||||
|
Removes trailing characters from string.
|
||||||
|
|
||||||
|
```
|
||||||
|
trimEnd(" abc ")
|
||||||
|
// result => Optional(" abc")
|
||||||
|
trimEnd("")
|
||||||
|
// result Optional.empty()
|
||||||
|
```
|
||||||
|
|
||||||
## surround
|
## surround
|
||||||
|
|
||||||
Surrounds a 'value' with the given 'prefix' and 'suffix'.
|
Surrounds a 'value' with the given 'prefix' and 'suffix'.
|
||||||
@@ -559,6 +582,42 @@ toSnakeCase("hello world")
|
|||||||
// result => "hello_world"
|
// result => "hello_world"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## upperFirst
|
||||||
|
|
||||||
|
Converts the first character of string to upper case.
|
||||||
|
|
||||||
|
```java
|
||||||
|
upperFirst("fred")
|
||||||
|
// result => "Fred"
|
||||||
|
```
|
||||||
|
|
||||||
|
## words
|
||||||
|
|
||||||
|
Splits a String to words
|
||||||
|
|
||||||
|
```java
|
||||||
|
words("This is a string, with words!")
|
||||||
|
// result => ["This", "is", "a", "string", "with", "words"]
|
||||||
|
```
|
||||||
|
|
||||||
|
## isEnclosedBetween
|
||||||
|
|
||||||
|
Verifies whether String is enclosed by encloser
|
||||||
|
|
||||||
|
```java
|
||||||
|
isEnclosedBetween("{{shekhar}}", "{{", "}}")
|
||||||
|
// result => true
|
||||||
|
```
|
||||||
|
|
||||||
|
## join
|
||||||
|
|
||||||
|
Join concatenates all the elements of the strings array into a single String. The separator string is placed between elements in the resulting string.
|
||||||
|
|
||||||
|
```java
|
||||||
|
join(new String[]{"hello","world","123"}, ";")
|
||||||
|
// result => "hello;world;123")
|
||||||
|
```
|
||||||
|
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
strman is licensed under the MIT License - see the `LICENSE` file for details.
|
strman is licensed under the MIT License - see the `LICENSE` file for details.
|
||||||
|
|||||||
Reference in New Issue
Block a user