public class UnprotectedString extends Object implements IString
| Constructor and Description |
|---|
UnprotectedString(char singleChar)
Create a string with a single character.
|
UnprotectedString(char[] chars)
Create an UnprotectedString based on an existing character array.
|
UnprotectedString(char[] chars,
int offset,
int len,
int usableLength)
Create an UnprotectedString based on an existing character array.
|
UnprotectedString(CharSequence s)
Creates an UnprotectedString from the given CharSequence (a copy of characters is done).
|
UnprotectedString(int initialCapacity)
Create an empty UnprotectedString with an initial capacity.
|
UnprotectedString(IString s)
Creates an UnprotectedString from the given String (a copy of characters is done).
|
UnprotectedString(String s)
Creates an UnprotectedString from the given String (a copy of characters is done).
|
| Modifier and Type | Method and Description |
|---|---|
UnprotectedString |
append(char c)
Append a character.
|
UnprotectedString |
append(char[] chars,
int offset,
int len)
Append characters.
|
UnprotectedString |
append(CharSequence s)
Append characters.
|
boolean |
appendNoEnlarge(char c)
Append the given character without enlarging the char array, return false if it cannot be done.
|
CharBuffer |
asCharBuffer()
Create a CharBuffer wrapping the current string.
|
CharBuffer[] |
asCharBuffers()
Convert into an array of character buffers.
|
int |
canAppendWithoutEnlarging()
Return then number of unused characters at the end of the array.
|
char[] |
charArray()
Return the underlying character array.
|
int |
charArrayStart()
Return the current start offset in the underlying character array.
|
char |
charAt(int index) |
int |
countChar(char c)
Return the number of occurences of the given array in this string.
|
boolean |
endsWith(CharSequence end)
Return true if this string ends with the given one.
|
int |
fill(char[] chars,
int start)
Fill the given character array with the content of this string.
|
int |
fillUsAsciiBytes(byte[] bytes,
int start)
Same as with char but with bytes, all characters are directly converted into bytes without CharsetEncoder.
|
int |
firstChar()
Return the first character, or -1 if the string is empty.
|
int |
indexOf(char c,
int pos)
Return the index of the first occurrence of the given character, starting at the given position, or -1 if not found.
|
int |
indexOf(CharSequence s,
int pos)
Return the index of the first occurrence of the given CharSequence, starting at the given position, or -1 if not found.
|
boolean |
isEmpty()
Return true if empty (length == 0).
|
int |
lastChar()
Return the last character, or -1 if the string is empty.
|
int |
length() |
void |
moveForward(int skip)
Remove the given number of characters at the beginning of the string.
|
UnprotectedString |
removeEndChars(int nb)
Remove the given number of characters at the end.
|
UnprotectedString |
removeStartChars(int nb)
Remove the given number of characters at the beginning.
|
UnprotectedString |
replace(char oldChar,
char newChar)
Replace all occurrences of oldChar into newChar.
|
void |
reset()
Make this string empty, only by setting the end offset to the start offset.
|
void |
setCharAt(int index,
char c)
Set the character at the given index.
|
List<UnprotectedString> |
split(char sep)
Return a list of strings, by splitting the current string using the given character as separator.
|
boolean |
startsWith(CharSequence start)
Return true if this string starts with the given one.
|
String |
subSequence(int start,
int end) |
UnprotectedString |
substring(int start)
Return a sub-string starting at the given position until the end.
|
UnprotectedString |
substring(int start,
int end)
Return a sub-string starting at the given start position (included) until the given end position (excluded).
|
UnprotectedString |
toLowerCase()
Convert this string to lower case.
|
String |
toString() |
UnprotectedString |
toUpperCase()
Convert this string to upper case.
|
UnprotectedString |
trimBeginning()
Remove spaces characters at the beginning of this string.
|
UnprotectedString |
trimEnd()
Remove spaces characters at the end of this string.
|
void |
trimToSize()
Create a new character array to fit the current content of this string.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitappend, asCharacters, asString, encode, equals, fill, fillUsAsciiBytes, indexOf, indexOf, isStartOf, toUsAsciiBytes, trimchars, codePointspublic UnprotectedString(int initialCapacity)
public UnprotectedString(char singleChar)
public UnprotectedString(char[] chars,
int offset,
int len,
int usableLength)
public UnprotectedString(char[] chars)
public UnprotectedString(String s)
public UnprotectedString(IString s)
public UnprotectedString(CharSequence s)
public int length()
length in interface CharSequencepublic boolean isEmpty()
IStringpublic void reset()
public char charAt(int index)
charAt in interface CharSequencepublic void setCharAt(int index,
char c)
public int firstChar()
public int lastChar()
public int canAppendWithoutEnlarging()
public void trimToSize()
public boolean appendNoEnlarge(char c)
public UnprotectedString append(char c)
IStringpublic UnprotectedString append(char[] chars, int offset, int len)
IStringpublic UnprotectedString append(CharSequence s)
IStringpublic int indexOf(char c,
int pos)
IStringpublic int indexOf(CharSequence s, int pos)
IStringpublic String subSequence(int start, int end)
subSequence in interface CharSequencepublic UnprotectedString substring(int start, int end)
IStringpublic UnprotectedString substring(int start)
IStringpublic UnprotectedString trimBeginning()
IStringtrimBeginning in interface IStringpublic UnprotectedString trimEnd()
IStringpublic UnprotectedString replace(char oldChar, char newChar)
IStringpublic UnprotectedString removeEndChars(int nb)
IStringremoveEndChars in interface IStringpublic UnprotectedString removeStartChars(int nb)
IStringremoveStartChars in interface IStringpublic void moveForward(int skip)
public int fill(char[] chars,
int start)
IStringpublic int fillUsAsciiBytes(byte[] bytes,
int start)
IStringfillUsAsciiBytes in interface IStringpublic List<UnprotectedString> split(char sep)
IStringpublic UnprotectedString toLowerCase()
IStringtoLowerCase in interface IStringpublic UnprotectedString toUpperCase()
IStringtoUpperCase in interface IStringpublic boolean startsWith(CharSequence start)
IStringstartsWith in interface IStringpublic boolean endsWith(CharSequence end)
IStringpublic String toString()
toString in interface CharSequencetoString in class Objectpublic CharBuffer asCharBuffer()
public CharBuffer[] asCharBuffers()
IStringasCharBuffers in interface IStringpublic char[] charArray()
public int charArrayStart()
public int countChar(char c)
Copyright © 2019. All rights reserved.