Android Guides | Samples

Java.Lang.String Class

An immutable sequence of UTF-16 chars.

See Also: String

Syntax

[Android.Runtime.Register("java/lang/String", DoNotGenerateAcw=true)]
public sealed class String : Object, ISerializable, ICharSequence, IComparable, IEnumerable<char>, IDisposable

Remarks

An immutable sequence of UTF-16 chars. See Character for details about the relationship between char and Unicode code points.

See Also

[Android Documentation]

Requirements

Namespace: Java.Lang
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Java.Lang.String are listed below.

See Also: Object

Public Constructors

Creates an empty string.
Creates a String from the contents of the specified StringBuffer.
Creates a String from the contents of the specified StringBuilder.
Converts the byte array to a string using the system's Charset.DefaultCharset.
Initializes this string to contain the given chars.
Constructs a new string with the same sequence of characters as toCopy.
Converts the byte array to a String using the given charset.
Converts the byte array to a string, setting the high byte of every char to the specified value.
Converts the byte array to a string using the named charset.
Converts a subsequence of the byte array to a string using the system's Charset.DefaultCharset.
Initializes this string to contain the given chars.
Creates a String from the sub-array of Unicode code points.
Converts the byte array to a string using the given charset.
Converts the byte array to a string, setting the high byte of every char to high.
Converts the byte array to a string using the named charset.

Public Properties

[read-only]
static
CaseInsensitiveOrderIComparator. Compares strings using String.CompareToIgnoreCase(String).
[read-only]
IsEmptyBoolean. Returns true if the length of this string is 0.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

CharAt(Int32) : Char
Returns the char at index.
CodePointAt(Int32) : Int32
Returns the Unicode code point at the given index.
CodePointBefore(Int32) : Int32
Returns the Unicode code point that precedes the given index.
CodePointCount(Int32, Int32) : Int32
Calculates the number of Unicode code points between start and end.
CompareTo(String) : Int32
Compares this string to the given string.
CompareToIgnoreCase(String) : Int32
Compares this string to the given string, ignoring case differences.
Concat(String) : String
Concatenates this string and the specified string.
Contains(ICharSequence) : Boolean
Returns true if this string contains the charss from the given CharSequence.
Contains(String) : Boolean
ContentEquals(ICharSequence) : Boolean
Returns true if the chars in the given CharSequence are the same as those in this string.
ContentEquals(StringBuffer) : Boolean
Returns true if the chars in the given StringBuffer are the same as those in this string.
ContentEquals(String) : Boolean
static
CopyValueOf(Char[]) : String
Creates a new string by copying the given char[].
static
CopyValueOf(Char[], Int32, Int32) : String
Creates a new string by copying the given subsequence of the given char[].
EndsWith(String) : Boolean
Compares the specified string to this string to determine if the specified string is a suffix.
EqualsIgnoreCase(String) : Boolean
Compares the given string to this string ignoring case.
static
Format(String, params Object[]) : String
static
Format(Locale, String, params Object[]) : String
GetBytes() : Byte[]
Returns a new byte array containing the code points in this string encoded using the system's Charset.DefaultCharset.
GetBytes(Charset) : Byte[]
Returns a new byte array containing the code points of this string encoded using the given charset.
GetBytes(String) : Byte[]
Returns a new byte array containing the code points of this string encoded using the named charset.
GetBytes(Int32, Int32, Byte[], Int32)
Mangles a subsequence of this string into a byte array by stripping the high order bits from each char.
GetChars(Int32, Int32, Char[], Int32)
Copies the given subsequence of this string to the given array starting at the given offset.
GetEnumerator() : IEnumerator<char>
IndexOf(Int32) : Int32
Returns the first index of the given code point, or -1.
IndexOf(String) : Int32
Returns the first index of the given string, or -1.
IndexOf(Int32, Int32) : Int32
Returns the next index of the given code point, or -1.
IndexOf(String, Int32) : Int32
Returns the next index of the given string in this string, or -1.
Intern() : String
Returns an interned string equal to this string.
LastIndexOf(Int32) : Int32
Returns the last index of the code point c, or -1.
LastIndexOf(String) : Int32
Returns the index of the start of the last match for the given string in this string, or -1.
LastIndexOf(Int32, Int32) : Int32
Returns the last index of the code point c, or -1.
LastIndexOf(String, Int32) : Int32
Returns the index of the start of the previous match for the given string in this string, or -1.
Length() : Int32
Returns the number of chars in this string.
Matches(String) : Boolean
Tests whether this string matches the given regularExpression.
OffsetByCodePoints(Int32, Int32) : Int32
Returns the index within this object that is offset from index by codePointOffset code points.
RegionMatches(Int32, String, Int32, Int32) : Boolean
Returns true if the given subsequence of the given string matches this string starting at the given offset.
RegionMatches(Boolean, Int32, String, Int32, Int32) : Boolean
Returns true if the given subsequence of the given string matches this string starting at the given offset.
Replace(ICharSequence, ICharSequence) : String
Returns a copy of this string after replacing occurrences of target replaced with replacement.
Replace(Char, Char) : String
Returns a copy of this string after replacing occurrences of the given char with another.
Replace(String, String) : String
ReplaceAll(String, String) : String
Replaces all matches for regularExpression within this string with the given replacement.
ReplaceFirst(String, String) : String
Replaces the first match for regularExpression within this string with the given replacement.
Split(String) : String[]
Splits this string using the supplied regularExpression.
Split(String, Int32) : String[]
Splits this string using the supplied regularExpression.
StartsWith(String) : Boolean
Compares the specified string to this string to determine if the specified string is a prefix.
StartsWith(String, Int32) : Boolean
Compares the specified string to this string, starting at the specified offset, to determine if the specified string is a prefix.
SubSequence(Int32, Int32) : String
SubSequenceFormatted(Int32, Int32) : ICharSequence
Equivalent to String.Substring(Int32,Int32) but needed to implement CharSequence.
Substring(Int32) : String
Returns a string containing a suffix of this string starting at start.
Substring(Int32, Int32) : String
Returns a string containing the given subsequence of this string.
ToCharArray() : Char[]
Returns a new char array containing a copy of the chars in this string.
ToLowerCase() : String
Converts this string to lower case, using the rules of the user's default locale.
ToLowerCase(Locale) : String
Converts this string to lower case, using the rules of locale.
override
ToString() : String
ToUpperCase() : String
Converts this this string to upper case, using the rules of the user's default locale.
ToUpperCase(Locale) : String
Converts this this string to upper case, using the rules of locale.
Trim() : String
Returns a string with no code points <= \\u0020 at the beginning or end.
static
ValueOf(Object) : String
Converts the specified object to its string representation.
static
ValueOf(Boolean) : String
Converts the specified boolean to its string representation.
static
ValueOf(Char) : String
Returns a new string of just the given char.
static
ValueOf(Char[]) : String
Returns a new string containing the same chars as the given array.
static
ValueOf(Double) : String
Returns the string representation of the given double.
static
ValueOf(Int32) : String
Returns the string representation of the given int.
static
ValueOf(Int64) : String
Returns the string representation of the given long.
static
ValueOf(Single) : String
Returns the string representation of the given float.
static
ValueOf(Char[], Int32, Int32) : String
Returns a new string containing the same chars as the given subset of the given array.

Explicitly Implemented Interface Members