public class StringCropper extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
StringCropper.StrPosition
property holder class called position-detail-info contains string and
it's position index.
|
| Constructor and Description |
|---|
StringCropper() |
| Modifier and Type | Method and Description |
|---|---|
String |
getAfterOf(String srcStr,
String token)
returns the string that is cropped after token
Method Example, getAfterOf("AAABCDBCDEEE","BCD") returns"EEE" |
String |
getAfterOf(String srcStr,
String token,
boolean useTailSearch)
returns the string that is cropped after token with position-detail-info
Method Example1 tail mode=true, getAfterOf("AAABCDBCDEEE","BCD",true) returns "EEE" Method Example2 tail mode=true, getAfterOf("AAABCDBCDEEE","BCD",true) returns "BCDEEE" |
StringCropper.StrPosition |
getAfterOfWithDetails(String srcStr,
String token)
returns the string that is cropped after token with position-detail-info
Method Example, getAfterOfWithDetails("AAABCDBCDEEE","BCD") returns str=EEE, startIndex=9, endIndex=11 |
StringCropper.StrPosition |
getAfterOfWithDetails(String srcStr,
String token,
boolean useTailSearch)
returns the string that is cropped after token with position-detail-info
Method Example1 tail mode=true, getAfterOfWithDetails("AAABCDBCDEEE","BCD",true) returns str=EEE, startIndex=9, endIndex=11 Method Example2 tail mode=true, getAfterOfWithDetails("AAABCDBCDEEE","BCD",true) returns str=BCDEEE, startIndex=6, endIndex=11 |
String |
getBeforeOf(String srcStr,
String token)
returns the string that is cropped before token with position-detail-info
|
StringCropper.StrPosition |
getBeforeOfWithDetails(String srcStr,
String token)
returns the string that is cropped before token with position-detail-info
|
String |
getLeftOf(String srcStr,
int charCount)
Returns the number of characters specified from left
|
String |
getRightOf(String srcStr,
int charCount)
Returns the number of characters specified from right
|
List<String> |
getStringEnclosedIn(String srcStr,
String startToken,
String endToken)
returns all of discovery that enclosed in specific tokens found in the
source string
|
String |
getStringEnclosedInFirst(String srcStr,
String startToken,
String endToken)
returns the first one that enclosed in specific tokens found in the
source string.
|
StringCropper.StrPosition |
getStringEnclosedInFirstWithDetails(String srcStr,
String startToken,
String endToken)
returns the first one that enclosed in specific tokens found in the
source string with position-detail-info
|
List<StringCropper.StrPosition> |
getStringEnclosedInWithDetails(String srcStr,
String startToken,
String endToken)
returns all of discovery that enclosed in specific tokens found in the
source string with position-detail-info.
|
boolean |
isBlank(String str)
return is string null or empty("") char
|
boolean |
isNotBlank(String str)
return string isn't null or empty("") char
|
String |
removeHead(String srcStr,
int charCount)
Return the rest of the string that is cropped the number of chars from
the beginning
|
String |
removeTail(String srcStr,
int charCount)
Return the rest of the string that is cropped the number of chars from
the end of string
|
List<String> |
splitByIndex(String srcStr,
Integer... splitPoint)
split string by index[indexes]
Example #splitByIndex("abcdefghi",2,5) returns StrPosition [str=abc, startIndex=0, endIndex=2] StrPosition [str=def, startIndex=3, endIndex=5] StrPosition [str=ghi, startIndex=6, endIndex=8] |
List<StringCropper.StrPosition> |
splitByIndexWithDetail(String srcStr,
Integer... splitPoint)
split string by index[indexes]
Example #splitByIndex("abcdefghi",2,5) returns StrPosition [str=abc, startIndex=0, endIndex=2] StrPosition [str=def, startIndex=3, endIndex=5] StrPosition [str=ghi, startIndex=6, endIndex=8] |
String |
stringAt(String srcStr,
int index)
returns string at index
|
int |
tailOf(String srcStr,
String searchStr)
Returns the index within this string of finally found value in the first
discovered string sequence
Method Example, tailOf("ABABsampletextABAB","AB") returns 2. (You know, String#indexOf returns 0.) |
public List<String> getStringEnclosedIn(String srcStr, String startToken, String endToken)
srcStr - startToken - endToken - public List<StringCropper.StrPosition> getStringEnclosedInWithDetails(String srcStr, String startToken, String endToken)
srcStr - startToken - endToken - public String getStringEnclosedInFirst(String srcStr, String startToken, String endToken)
srcStr - startToken - endToken - public StringCropper.StrPosition getStringEnclosedInFirstWithDetails(String srcStr, String startToken, String endToken)
srcStr - startToken - endToken - public String stringAt(String srcStr, int index)
srcStr - index - public String getBeforeOf(String srcStr, String token)
srcStr - token - public StringCropper.StrPosition getBeforeOfWithDetails(String srcStr, String token)
srcStr - token - public String getAfterOf(String srcStr, String token, boolean useTailSearch)
srcStr - token - useTailSearch - public String getAfterOf(String srcStr, String token)
srcStr - token - public StringCropper.StrPosition getAfterOfWithDetails(String srcStr, String token)
srcStr - token - public StringCropper.StrPosition getAfterOfWithDetails(String srcStr, String token, boolean useTailSearch)
srcStr - token - useTailSearch - is use tail modetailOf(String, String)public int tailOf(String srcStr, String searchStr)
srcStr - searchStr - public String removeTail(String srcStr, int charCount)
srcStr - charCount - public String removeHead(String srcStr, int charCount)
srcStr - charCount - public String getLeftOf(String srcStr, int charCount)
srcStr - charCount - public String getRightOf(String srcStr, int charCount)
srcStr - charCount - public List<String> splitByIndex(String srcStr, Integer... splitPoint)
srcStr - splitPoint - public List<StringCropper.StrPosition> splitByIndexWithDetail(String srcStr, Integer... splitPoint)
srcStr - splitPoint - public boolean isNotBlank(String str)
str - public boolean isBlank(String str)
str - Copyright © 2016. All rights reserved.