String String Constructors

Definition

Overloads

String()

Creates an empty string.

String(Byte[], Int32, Int32, String) String(Byte[], Int32, Int32, String)

Converts the byte array to a string using the named charset.

String(Byte[], Int32, Int32, Int32) String(Byte[], Int32, Int32, Int32)

Converts the byte array to a string, setting the high byte of every char to high.

String(Byte[], Int32, Int32, Charset) String(Byte[], Int32, Int32, Charset)

Converts the byte array to a string using the given charset.

String(Int32[], Int32, Int32) String(Int32[], Int32, Int32)

Creates a String from the sub-array of Unicode code points.

String(Char[], Int32, Int32) String(Char[], Int32, Int32)

Initializes this string to contain the given chars.

String(Byte[], String) String(Byte[], String)

Converts the byte array to a string using the named charset.

String(Byte[], Int32, Int32) String(Byte[], Int32, Int32)

Converts a subsequence of the byte array to a string using the system's DefaultCharset().

String(Byte[], Charset) String(Byte[], Charset)

Converts the byte array to a String using the given charset.

String(String) String(String)

Constructs a new string with the same sequence of characters as toCopy.

String(Char[]) String(Char[])

Initializes this string to contain the given chars.

String(Byte[]) String(Byte[])

Converts the byte array to a string using the system's DefaultCharset().

String(StringBuilder) String(StringBuilder)

Creates a String from the contents of the specified StringBuilder.

String(StringBuffer) String(StringBuffer)

Creates a String from the contents of the specified StringBuffer.

String(Byte[], Int32) String(Byte[], Int32)

Converts the byte array to a string, setting the high byte of every char to the specified value.

String()

Creates an empty string.

[Android.Runtime.Register(".ctor", "()V", "")]
public String ();

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

String(Byte[], Int32, Int32, String) String(Byte[], Int32, Int32, String)

Converts the byte array to a string using the named charset.

[Android.Runtime.Register(".ctor", "([BIILjava/lang/String;)V", "")]
public String (byte[] bytes, int offset, int length, string charsetName);
new Java.Lang.String : byte[] * int * int * string -> Java.Lang.String

Parameters

bytes
Byte[]
offset
Int32 Int32
length
Int32 Int32
charsetName
String String

Exceptions

if the named charset is not supported.

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

String(Byte[], Int32, Int32, Int32) String(Byte[], Int32, Int32, Int32)

Warning

This API is now obsolete.

Converts the byte array to a string, setting the high byte of every char to high.

[Android.Runtime.Register(".ctor", "([BIII)V", "")]
[System.Obsolete("deprecated")]
public String (byte[] ascii, int hibyte, int offset, int count);
new Java.Lang.String : byte[] * int * int * int -> Java.Lang.String

Parameters

ascii
Byte[]
hibyte
Int32 Int32
offset
Int32 Int32
count
Int32 Int32

Exceptions

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

String(Byte[], Int32, Int32, Charset) String(Byte[], Int32, Int32, Charset)

Converts the byte array to a string using the given charset.

[Android.Runtime.Register(".ctor", "([BIILjava/nio/charset/Charset;)V", "", ApiSince=9)]
public String (byte[] bytes, int offset, int length, Java.Nio.Charset.Charset charset);
new Java.Lang.String : byte[] * int * int * Java.Nio.Charset.Charset -> Java.Lang.String

Parameters

bytes
Byte[]
offset
Int32 Int32
length
Int32 Int32
charset
Charset Charset

Exceptions

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

String(Int32[], Int32, Int32) String(Int32[], Int32, Int32)

Creates a String from the sub-array of Unicode code points.

[Android.Runtime.Register(".ctor", "([III)V", "")]
public String (int[] codePoints, int offset, int count);
new Java.Lang.String : int[] * int * int -> Java.Lang.String

Parameters

codePoints
Int32[]
offset
Int32 Int32
count
Int32 Int32

Exceptions

if any of the elements of codePoints are not valid Unicode code points.

if offset or count are not within the bounds of codePoints.

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

String(Char[], Int32, Int32) String(Char[], Int32, Int32)

Initializes this string to contain the given chars.

[Android.Runtime.Register(".ctor", "([CII)V", "")]
public String (char[] data, int offset, int charCount);
new Java.Lang.String : char[] * int * int -> Java.Lang.String

Parameters

data
Char[]
offset
Int32 Int32
charCount
Int32 Int32

Exceptions

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

String(Byte[], String) String(Byte[], String)

Converts the byte array to a string using the named charset.

[Android.Runtime.Register(".ctor", "([BLjava/lang/String;)V", "")]
public String (byte[] bytes, string charsetName);
new Java.Lang.String : byte[] * string -> Java.Lang.String

Parameters

bytes
Byte[]
charsetName
String String

Exceptions

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

String(Byte[], Int32, Int32) String(Byte[], Int32, Int32)

Converts a subsequence of the byte array to a string using the system's DefaultCharset().

[Android.Runtime.Register(".ctor", "([BII)V", "")]
public String (byte[] bytes, int offset, int length);
new Java.Lang.String : byte[] * int * int -> Java.Lang.String

Parameters

bytes
Byte[]
offset
Int32 Int32
length
Int32 Int32

Exceptions

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

String(Byte[], Charset) String(Byte[], Charset)

Converts the byte array to a String using the given charset.

[Android.Runtime.Register(".ctor", "([BLjava/nio/charset/Charset;)V", "", ApiSince=9)]
public String (byte[] bytes, Java.Nio.Charset.Charset charset);
new Java.Lang.String : byte[] * Java.Nio.Charset.Charset -> Java.Lang.String

Parameters

bytes
Byte[]
charset
Charset Charset

Exceptions

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

String(String) String(String)

Constructs a new string with the same sequence of characters as toCopy.

[Android.Runtime.Register(".ctor", "(Ljava/lang/String;)V", "")]
public String (string toCopy);
new Java.Lang.String : string -> Java.Lang.String

Parameters

toCopy
String String

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

String(Char[]) String(Char[])

Initializes this string to contain the given chars.

[Android.Runtime.Register(".ctor", "([C)V", "")]
public String (char[] data);
new Java.Lang.String : char[] -> Java.Lang.String

Parameters

data
Char[]

Exceptions

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

String(Byte[]) String(Byte[])

Converts the byte array to a string using the system's DefaultCharset().

[Android.Runtime.Register(".ctor", "([B)V", "")]
public String (byte[] bytes);
new Java.Lang.String : byte[] -> Java.Lang.String

Parameters

bytes
Byte[]

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

String(StringBuilder) String(StringBuilder)

Creates a String from the contents of the specified StringBuilder.

[Android.Runtime.Register(".ctor", "(Ljava/lang/StringBuilder;)V", "")]
public String (Java.Lang.StringBuilder builder);
new Java.Lang.String : Java.Lang.StringBuilder -> Java.Lang.String

Parameters

Exceptions

if stringBuilder == null.

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

String(StringBuffer) String(StringBuffer)

Creates a String from the contents of the specified StringBuffer.

[Android.Runtime.Register(".ctor", "(Ljava/lang/StringBuffer;)V", "")]
public String (Java.Lang.StringBuffer buffer);
new Java.Lang.String : Java.Lang.StringBuffer -> Java.Lang.String

Parameters

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

String(Byte[], Int32) String(Byte[], Int32)

Warning

This API is now obsolete.

Converts the byte array to a string, setting the high byte of every char to the specified value.

[Android.Runtime.Register(".ctor", "([BI)V", "")]
[System.Obsolete("deprecated")]
public String (byte[] ascii, int hibyte);
new Java.Lang.String : byte[] * int -> Java.Lang.String

Parameters

ascii
Byte[]
hibyte
Int32 Int32

Exceptions

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to