public class StringFunctions_B
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
sWhiteSpaces |
static java.lang.String |
version
Version, history and license.
|
Constructor and Description |
---|
StringFunctions_B() |
Modifier and Type | Method and Description |
---|---|
static boolean |
checkMoreSameChars(java.lang.CharSequence src,
java.lang.CharSequence... check) |
static boolean |
checkOneSameChars(java.lang.CharSequence src,
java.lang.CharSequence... check)
Checks whether any char is existing in at least one given check Strings.
|
static boolean |
checkSameChars(java.lang.CharSequence... src)
Checks whether any char is existing in all given src.
|
static java.lang.CharSequence |
convertBackslashChars(java.lang.CharSequence src)
Converts a backslash sequence to a appropriate character.
|
static java.lang.String |
firstLine(java.lang.CharSequence src)
Returns the first line of any text.
|
static java.lang.CharSequence |
removeIndentReplaceNewline(java.lang.CharSequence src,
int indent,
java.lang.String indentChars,
int tabSize,
java.lang.String sNewline,
boolean bSkipSpaces)
Cleans a text which may be parsed or such, remove undesired indentation and replace the line end characters.
|
static java.lang.CharSequence |
removeLeadingTrailingWhiteSpacesAndQuotation(java.lang.CharSequence src,
char cQuotation) |
static java.lang.CharSequence |
removeLeadingWhiteSpaces(java.lang.CharSequence src) |
static java.lang.CharSequence |
replace(java.lang.CharSequence src,
char cc,
char cr)
Replaces all occurences of cc to cr.
|
static java.lang.CharSequence |
replaceNonIdentifierChars(java.lang.CharSequence src,
char lowerOrUpper)
Build a Java Identifier from a given String, maybe tag name in Xml etc.
|
static java.lang.String |
toFirstLowercase(java.lang.String src)
Converts the first character to lower case if it
Character.isUpperCase(char) ('A'..' |
static java.lang.String |
toFirstUppercase(java.lang.String src)
Converts the first character to upper case if it
Character.isLowerCase(char) ('a'..' |
public static final java.lang.String version
replace(CharSequence, char, char)
convertBackslashChars(CharSequence)
#checkSameItem(String, CharSequence...)
and #prepareCheckSameItem(String)
.
This is newly used in the org.vishia.stimuliSelector.StimuliSelector
in the script for selection.
More ability.
checkOneSameChars(CharSequence, CharSequence...)
and checkMoreSameChars(CharSequence, CharSequence...)
as enhancement to 2016-activity
used in org.vishia.stimuliSelector.StimuliSelector
in the script for selection.
checkSameChars(CharSequence...)
public static final java.lang.String sWhiteSpaces
public static java.lang.String firstLine(java.lang.CharSequence src)
src
- if null then returns "" (empty String)public static java.lang.CharSequence removeLeadingWhiteSpaces(java.lang.CharSequence src)
public static java.lang.CharSequence removeLeadingTrailingWhiteSpacesAndQuotation(java.lang.CharSequence src, char cQuotation)
public static java.lang.CharSequence removeIndentReplaceNewline(java.lang.CharSequence src, int indent, java.lang.String indentChars, int tabSize, java.lang.String sNewline, boolean bSkipSpaces)
src
- Any source String with indentationindent
- column which indentation should be removedIndentChars
- some Characters which are expected in the indentation area.tabSize
- User tab size to prevent tabs as indentationsNewline
- String as newline designation, usual "\n", "\r\n" or "\r".bSkipSpaces
- true then skip over the first whitespace characters in all following lines.public static boolean checkSameChars(java.lang.CharSequence... src)
src
- some char sequencespublic static boolean checkOneSameChars(java.lang.CharSequence src, java.lang.CharSequence... check)
src
- some chars to checkcheck
- some strings where the check chars should be found.public static boolean checkMoreSameChars(java.lang.CharSequence src, java.lang.CharSequence... check)
public static java.lang.CharSequence replace(java.lang.CharSequence src, char cc, char cr)
src
- cc
- cr
- public static java.lang.CharSequence replaceNonIdentifierChars(java.lang.CharSequence src, char lowerOrUpper)
src
- Any String. Non-conform characters will be replaced by '_'lowerOrUpper
- if'a' or 'A' converts the first char to lower or upper. If '-' do not convert.public static java.lang.CharSequence convertBackslashChars(java.lang.CharSequence src)
\a | 0x07 (bell) | C# convention |
\b | 0x08 (backspace) | Java convention |
\cX | 0x00..0x1f (X is the ASCII 0x40..7e, builds ctrl character) | C# convention, enhanced |
\e | 0x1b (escape) | C# convention |
\f | 0x0c (form feed, page break) | Java convention |
\n | 0x0a (new line) | Java convention |
\r | 0x0d (carriage return) | Java convention |
\t | 0x09 (tab) | Java convention |
\ u | todo UTF | C# convention |
\x | 0x00..FF (ASCII) | C# convention |
\} | 0x5F, \ itself | Java convention |
src
- public static java.lang.String toFirstLowercase(java.lang.String src)
Character.isUpperCase(char)
('A'..'Z').
If the src starts with '_' or it is not an identifier, src will be returned.
The rest of the src is left unchanged.
Use replaceNonIdentifierChars(CharSequence, char)
to convert maybe non identifier words to identifier words.src
- public static java.lang.String toFirstUppercase(java.lang.String src)
Character.isLowerCase(char)
('a'..'z').
If the src starts with '_' or it is not an identifier, src will be returned.
The rest of the src is left unchanged.
Use replaceNonIdentifierChars(CharSequence, char)
to convert maybe non identifier words to identifier words.src
-