public final class String4D extends java.lang.Object implements java.lang.Comparable<String4D>, java.lang.CharSequence
Constructor and Description |
---|
String4D()
Creates an empty string.
|
String4D(byte[] value)
Creates a string from the given byte array.
|
String4D(byte[] value,
int offset,
int count)
Creates a string from the given byte array.
|
String4D(byte[] value,
int offset,
int count,
java.lang.String encoding) |
String4D(char[] c)
Creates a string from the given character array.
|
String4D(char[] value,
int offset,
int count)
Allocates a new String that contains characters from a subarray of the character array argument.
|
String4D(java.lang.CharSequence cs) |
String4D(String4D s)
Creates a copy of the given string.
|
String4D(StringBuffer4D buffer)
Creates a new String using the character sequence represented by
the StringBuffer.
|
Modifier and Type | Method and Description |
---|---|
char |
charAt(int i)
Returns the character at the given position.
|
int |
compareTo(String4D s)
Compares this string with another lexicographically.
|
int |
compareToIgnoreCase(String4D str)
Compares this String and another String (case insensitive).
|
String4D |
concat(String4D s)
Concatenates the given string to this string and returns the result.
|
boolean |
contains(java.lang.CharSequence part) |
boolean |
contains(String4D part) |
boolean |
contentEquals(StringBuffer4D buffer)
Compares the given StringBuffer to this String.
|
boolean |
endsWith(String4D suffix)
Tests if this string ends with the specified suffix.
|
boolean |
equals(java.lang.Object obj)
Returns true if the given string is equal to this string and false
otherwise.
|
boolean |
equalsIgnoreCase(String4D s)
Returns true if the given string is equal to this string using caseless comparison and false
otherwise.
|
byte[] |
getBytes()
Return this String as bytes.
|
byte[] |
getBytes(java.nio.charset.Charset charset) |
byte[] |
getBytes(java.lang.String charsetName) |
void |
getChars(int srcBegin,
int srcEnd,
char[] dst,
int dstBegin)
Copies characters from this String into the specified character array.
|
int |
hashCode()
Returns the hashcode for this string
|
int |
indexOf(int c)
Returns the index of the specified char in this string starting from 0, or -1 if not found
|
int |
indexOf(int c,
int startIndex)
Returns the index of the specified char in this string, or -1 if not found
|
int |
indexOf(String4D c)
Returns the index of the specified string in this string, or -1 if not found or the index is invalid
|
int |
indexOf(String4D c,
int startIndex)
Returns the index of the specified string in this string starting from the given index, or -1 if not found.
|
boolean |
isEmpty()
Returns true if, and only if,
length()
is 0 . |
int |
lastIndexOf(int c)
Returns the last index of the specified char in this string starting from length-1, or -1 if not found
|
int |
lastIndexOf(int c,
int startIndex)
Returns the last index of the specified char in this string, or -1 if not found
|
int |
lastIndexOf(String4D s)
Returns the last index of the specified string in this string starting from length-1, or -1 if not found.
|
int |
lastIndexOf(String4D s,
int startIndex)
Returns the last index of the specified string in this string starting from the given starting index, or -1 if not found.
|
int |
length()
Returns the length of the string in characters.
|
boolean |
matches(java.lang.String regex)
Test if this String matches a regular expression.
|
boolean |
regionMatches(boolean ignoreCase,
int toffset,
String4D other,
int ooffset,
int len)
Predicate which determines if this String matches another String
starting at a specified offset for each String and continuing
for a specified length, optionally ignoring case.
|
boolean |
regionMatches(int toffset,
String4D other,
int ooffset,
int len)
Predicate which determines if this String matches another String
starting at a specified offset for each String and continuing
for a specified length.
|
String4D |
replace(char oldChar,
char newChar)
Returns a new String with the given oldChar replaced by the newChar
|
java.lang.String |
replace(java.lang.CharSequence targetcs,
java.lang.CharSequence replacementcs)
Returns a string that is this string with all instances of the sequence
represented by
target replaced by the sequence in
replacement . |
java.lang.String |
replaceAll(java.lang.String regex,
java.lang.String replacement)
Replaces all matching substrings of the regular expression with a
given replacement.
|
java.lang.String |
replaceFirst(java.lang.String regex,
java.lang.String replacement)
Replaces the first substring match of the regular expression with a
given replacement.
|
java.lang.String[] |
split(java.lang.String regex)
Split this string around the matches of a regular expression.
|
boolean |
startsWith(String4D prefix)
Tests if this string starts with the specified prefix.
|
boolean |
startsWith(String4D prefix,
int from)
Tests if this string starts with the specified prefix.
|
java.lang.CharSequence |
subSequence(int beginIndex,
int endIndex) |
String4D |
substring(int start)
Returns a substring starting from start to the end of the string.
|
String4D |
substring(int start,
int end)
Returns a substring of the string.
|
char[] |
toCharArray()
Returns this string as a character array.
|
String4D |
toLowerCase()
Returns a new instance of this string converted to lower case
|
String4D |
toString4D()
Returns this string.
|
String4D |
toUpperCase()
Returns a new instance of this string converted to upper case
|
String4D |
trim()
Removes characters less than or equal to ' ' (space) from the beginning and end of this String
|
static java.lang.String |
valueOf(boolean b)
Converts the given boolean to a String (in lowercase).
|
static String4D |
valueOf(char c)
Converts the given char to a String.
|
static String4D |
valueOf(char[] data)
Returns a String representation of a character array.
|
static String4D |
valueOf(char[] data,
int offset,
int count)
Returns a String representing the character sequence of the char array,
starting at the specified offset, and copying chars up to the specified
count.
|
static String4D |
valueOf(double d)
Converts the given double to a String.
|
static String4D |
valueOf(int i)
Converts the given int to a String.
|
static java.lang.String |
valueOf(long l)
Converts the given long value to a String.
|
static java.lang.String |
valueOf(java.lang.Object obj)
Returns the string representation of the given object.
|
public String4D()
public String4D(java.lang.CharSequence cs)
public String4D(String4D s)
public String4D(char[] c)
public String4D(char[] value, int offset, int count)
value
- array that is the source of characters.offset
- the initial offset.count
- the length.java.lang.IndexOutOfBoundsException
- If the offset and count arguments index characters outside the bounds of the value array.public String4D(byte[] value, int offset, int count)
public String4D(byte[] value, int offset, int count, java.lang.String encoding) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
public String4D(byte[] value)
public String4D(StringBuffer4D buffer)
buffer
- StringBuffer to copyjava.lang.NullPointerException
- if buffer is nullpublic int length()
length
in interface java.lang.CharSequence
public char charAt(int i)
charAt
in interface java.lang.CharSequence
public String4D concat(String4D s)
public char[] toCharArray()
public String4D toString4D()
public static java.lang.String valueOf(java.lang.Object obj)
public String4D substring(int start, int end)
string.substring(4, 6);a string created from characters 4 and 5 will be returned.
start
- the first character of the substringend
- the character after the last character of the substringpublic String4D substring(int start)
start
- the first character of the substringpublic boolean startsWith(String4D prefix, int from)
prefix
- the prefix.from
- where to begin looking in the string.true
if the character sequence represented by the
argument is a prefix of the substring of this object starting
at index toffset
; false
otherwise.public boolean startsWith(String4D prefix)
prefix
- the prefix.true
if the character sequence represented by the
argument is a prefix of the character sequence represented by
this string; false
otherwise.public boolean endsWith(String4D suffix)
suffix
- the suffix.true
if the character sequence represented by the
argument is a suffix of the character sequence represented by
this object; false
otherwise.public boolean equalsIgnoreCase(String4D s)
public String4D replace(char oldChar, char newChar)
public int lastIndexOf(int c, int startIndex)
public int lastIndexOf(int c)
public int lastIndexOf(String4D s)
CAUTION: this method does not exist in BlackBerry, so if you use it, your program will fail in Blackberry.
public int lastIndexOf(String4D s, int startIndex)
CAUTION: this method does not exist in BlackBerry, so if you use it, your program will fail in Blackberry.
public String4D trim()
public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
srcBegin
- index of the first character in the stringsrcEnd
- end of the characters that are copieddst
- the destination arraydstBegin
- the start offset in the destination arraypublic byte[] getBytes()
Convert.setDefaultConverter(String)
,
CharacterConverter
,
UTF8CharacterConverter
public byte[] getBytes(java.nio.charset.Charset charset)
public byte[] getBytes(java.lang.String charsetName) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
public String4D toUpperCase()
public String4D toLowerCase()
public int indexOf(String4D c)
public static java.lang.String valueOf(long l)
public static java.lang.String valueOf(boolean b)
public static String4D valueOf(double d)
public static String4D valueOf(char c)
public static String4D valueOf(int i)
public int indexOf(int c)
public int indexOf(int c, int startIndex)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int compareTo(String4D s)
compareTo
in interface java.lang.Comparable<String4D>
public int indexOf(String4D c, int startIndex)
public int hashCode()
hashCode
in class java.lang.Object
public boolean contains(String4D part)
public boolean contains(java.lang.CharSequence part)
public boolean contentEquals(StringBuffer4D buffer)
buffer
- the StringBuffer to compare tojava.lang.NullPointerException
- if the given StringBuffer is nullpublic int compareToIgnoreCase(String4D str)
Character.toLowerCase(Character.toUpperCase(c))
on each
character of the string.str
- the string to compare againstCollator.compare(String, String)
public boolean regionMatches(int toffset, String4D other, int ooffset, int len)
toffset
- index to start comparison at for this Stringother
- String to compare region to this Stringooffset
- index to start comparison at for otherlen
- number of characters to comparejava.lang.NullPointerException
- if other is nullpublic boolean regionMatches(boolean ignoreCase, int toffset, String4D other, int ooffset, int len)
Character.toLowerCase()
and
Character.toUpperCase()
, not on multi-character
capitalization expansions.ignoreCase
- true if case should be ignored in comparisiontoffset
- index to start comparison at for this Stringother
- String to compare region to this Stringooffset
- index to start comparison at for otherlen
- number of characters to comparejava.lang.NullPointerException
- if other is nullpublic boolean matches(java.lang.String regex)
Pattern
.matches(regex, this)
.regex
- the pattern to matchjava.lang.NullPointerException
- if regex is nullPatternSyntaxException
- if regex is invalidpublic java.lang.String replaceFirst(java.lang.String regex, java.lang.String replacement)
Pattern
.compile(regex).matcher(this).replaceFirst(replacement)
.regex
- the pattern to matchreplacement
- the replacement stringjava.lang.NullPointerException
- if regex or replacement is nullPatternSyntaxException
- if regex is invalidreplaceAll(String, String)
,
Pattern.compile(String)
public java.lang.String replaceAll(java.lang.String regex, java.lang.String replacement)
Pattern
.compile(regex).matcher(this).replaceAll(replacement)
.regex
- the pattern to matchreplacement
- the replacement stringjava.lang.NullPointerException
- if regex or replacement is nullPatternSyntaxException
- if regex is invalidPattern.compile(String)
public java.lang.String[] split(java.lang.String regex)
split(regex, 0)
.regex
- the pattern to matchjava.lang.NullPointerException
- if regex or replacement is nullPatternSyntaxException
- if regex is invalidPattern.compile(String)
public static String4D valueOf(char[] data)
data
- the character arrayjava.lang.NullPointerException
- if data is nullvalueOf(char[], int, int)
public static String4D valueOf(char[] data, int offset, int count)
data
- character arrayoffset
- position (base 0) to start copying out of datacount
- the number of characters from data to copyjava.lang.NullPointerException
- if data is nulljava.lang.IndexOutOfBoundsException
- if (offset < 0 || count < 0
|| offset + count > data.length)
(while unspecified, this is a StringIndexOutOfBoundsException)public boolean isEmpty()
length()
is 0
.public java.lang.String replace(java.lang.CharSequence targetcs, java.lang.CharSequence replacementcs)
target
replaced by the sequence in
replacement
.target
- the sequence to be replacedreplacement
- the sequence used as the replacementpublic java.lang.CharSequence subSequence(int beginIndex, int endIndex)
subSequence
in interface java.lang.CharSequence