public class ConvertString extends Object
| Modifier and Type | Field and Description |
|---|---|
static String[] |
WHITESPACE_CHARS |
| Constructor and Description |
|---|
ConvertString()
This constructor is used to some cases but except removing a specify repeated String
removeRepeatedChar(String). |
ConvertString(String repeatStr)
This constructor is used to remove a specify repeated String
removeRepeatedChar(String) . |
| Modifier and Type | Method and Description |
|---|---|
String |
removeRepeatedChar(String input)
Remove consecutive repeated characters by a specified char.
|
String |
removeRepeatedWhitespaces(String input)
Remove all repeated white spaces which include all strings in
WHITESPACE_CHARS
like as " ","\n","\r","\t". |
String |
removeTrailingAndLeading(String input)
Remove trailing and leading characters and the remove Character is whitespace only.
|
String |
removeTrailingAndLeading(String input,
String character)
Remove trailing and leading characters.
|
String |
removeTrailingAndLeadingWhitespaces(String input)
Remove trailing and leading characters which may be empty string,
space string,\t,\n,\r,\f...any space, break related
characters.
|
public static final String[] WHITESPACE_CHARS
public ConvertString()
removeRepeatedChar(String).public ConvertString(String repeatStr)
removeRepeatedChar(String) .repeatStr - it is a repeat Stringpublic String removeTrailingAndLeadingWhitespaces(String input)
input - - the input text.public String removeTrailingAndLeading(String input)
input - - the input text.public String removeTrailingAndLeading(String input, String character)
input - - the input text.character - - the remove character.public String removeRepeatedChar(String input)
input - the source Stringpublic String removeRepeatedWhitespaces(String input)
WHITESPACE_CHARS
like as " ","\n","\r","\t".
removeRepeatedWhitespaces(null) = null
removeRepeatedWhitespaces("") = ""
removeRepeatedWhitespaces("a back\t\t\td") = "a back\td"
input - input the source StringCopyright © 2022 CDAP Licensed under the Apache License, Version 2.0.