Updated documentation to version 0.3.0

This commit is contained in:
Shekhar Gulati
2017-05-12 16:01:33 +05:30
parent d6dbe785cb
commit 7bcc0df6a5
+59
View File
@@ -26,6 +26,8 @@ Gradle users can add following to their build.gradle file.
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
These are the available functions in current version of library:
@@ -80,6 +82,16 @@ chars("title")
// 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
Replace consecutive whitespace characters with a single space.
@@ -496,6 +508,17 @@ transliterate("fóõ bár")
// result => "foo bar"
```
## trimEnd
Removes trailing characters from string.
```
trimEnd(" abc ")
// result => Optional(" abc")
trimEnd("")
// result Optional.empty()
```
## surround
Surrounds a 'value' with the given 'prefix' and 'suffix'.
@@ -559,6 +582,42 @@ toSnakeCase("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
-------
strman is licensed under the MIT License - see the `LICENSE` file for details.