|
GlueGen v2.6.0-rc-20250712
GlueGen, Native Binding Generator for Java (public API).
|
Basic utility functions for String and CharSequence in general.
More...
Static Public Member Functions | |
| static boolean | isWhitespace (final int cp) |
Return true if given codepoint in included within WHITESPACE. More... | |
| static boolean | isFullwidth (final int cp) |
| Returns true if given codepoint is a fullwidth unicode character. More... | |
| static boolean | isHalfwidth (final int cp) |
| Returns true if given codepoint is a halfwidth unicode character. More... | |
| static boolean | hasSpace (final int cp) |
Returns true if given codepoint is either isFullwidth(int), isHalfwidth(int) or isWhitespace(int). More... | |
| static int | getLineCount (final CharSequence s) |
| Returns number of lines, i.e. More... | |
| static int | indexOf (final String hay, final int needle, final int start) |
Calls String#indexOf(int, int). More... | |
| static int | indexOf (final CharSequence hay, final int needle, final int start) |
Naive implementation of String#indexOf(int, int) for type CharSequence. More... | |
| static String | trim (final String text, final String separators, final String replacement) |
Remove all leading, trailing and duplicate-within separators unicode character from the text. More... | |
| static List< String > | split (final String text, final int lineCount, final String separators) |
Returns an array of split text at separators or whitespace. More... | |
| static String | split (final String text, final int lineCount, final String separators, final String lineSeparator) |
Returns a multi-line string of split text at separators or whitespace glued with given lineSeparator. More... | |
Static Public Attributes | |
| static final char | LF = '\n' |
Linefeed character unicode '\n', 0x000A. More... | |
| static final char | CR = '\r' |
CR character unicode '\r', 0x000D. More... | |
| static final char | SPACE = ' ' |
Space character unicode ' ', 0x0020. More... | |
| static final String | WHITESPACE |
List of ASCII & Unicode space separator, aka Whitespace. More... | |
Basic utility functions for String and CharSequence in general.
Definition at line 34 of file StringUtil.java.
|
static |
Returns number of lines, i.e.
number of non-empty lines, separated by LF.
Definition at line 102 of file StringUtil.java.
|
static |
Returns true if given codepoint is either isFullwidth(int), isHalfwidth(int) or isWhitespace(int).
Definition at line 97 of file StringUtil.java.
|
static |
Naive implementation of String#indexOf(int, int) for type CharSequence.
Uses String#indexOf(int, int) if hay is of type String, otherwise
| hay | the unicode character string to search in from fromIdx |
| needle | the unicode code point character to search |
| start | index to start searching |
-1 if not found, otherwise [0..String#length()-1]. Definition at line 150 of file StringUtil.java.
|
static |
Calls String#indexOf(int, int).
| hay | the unicode character string to search in from fromIdx |
| needle | the unicode code point character to search |
| start | index to start searching |
-1 if not found, otherwise [0..String#length()-1]. Definition at line 131 of file StringUtil.java.
|
static |
Returns true if given codepoint is a fullwidth unicode character.
Definition at line 85 of file StringUtil.java.
|
static |
Returns true if given codepoint is a halfwidth unicode character.
Definition at line 92 of file StringUtil.java.
|
static |
Return true if given codepoint in included within WHITESPACE.
Definition at line 77 of file StringUtil.java.
|
static |
Returns an array of split text at separators or whitespace.
Each line's cutting point is the first separator or whitespace occurrence starting at text.length() / lineCount * 0.9.
The separator or whitespace character at the cutting point is skipped in the resulting array of the split parts, i.e. lines.
| text | the text to be split, null results in an empty list |
| lineCount | number of resulting lines |
| separators | separator unicode characters, pass null for whitespace. Consider using WHITESPACE to cover all unicode space character. |
Definition at line 254 of file StringUtil.java.
|
static |
Returns a multi-line string of split text at separators or whitespace glued with given lineSeparator.
Each line's cutting point is the first separator or whitespace occurrence starting at text.length() / lineCount * 0.9.
The separator character or whitespace at the cutting point is skipped in the string of glued split parts, i.e. lines.
| text | the text to be split, null results in an empty list |
| lineCount | number of resulting lines |
| separators | separator unicode characters, pass null for whitespace. Consider using WHITESPACE to cover all unicode space character. |
| lineSeparator | the glue placed between the split lines in the concatenated result |
Definition at line 315 of file StringUtil.java.
|
static |
Remove all leading, trailing and duplicate-within separators unicode character from the text.
Duplicate separators unicode character within the text are reduced to one occurrence and might be replaced with replacement if not null.
| text | the source text |
| separators | separator unicode characters, pass null for whitespace. Consider using WHITESPACE to cover all unicode space character. |
| replacement | optional replacement string for matched separator within sequence removing duplicated. If null, the first found separator is used. |
Definition at line 192 of file StringUtil.java.
|
static |
CR character unicode '\r', 0x000D.
Definition at line 38 of file StringUtil.java.
|
static |
Linefeed character unicode '\n', 0x000A.
Definition at line 36 of file StringUtil.java.
|
static |
Space character unicode ' ', 0x0020.
Definition at line 40 of file StringUtil.java.
|
static |
List of ASCII & Unicode space separator, aka Whitespace.
Definition at line 50 of file StringUtil.java.