Class String
public class String : JVMBridgeBase<String>, IDynamicMetaObjectProvider, IJVMBridgeCore, IEquatable<IJVMBridgeBaseInstance>, IDisposable, IJVMBridgeBaseStatic, IJVMBridgeBase, IJVMBridgeBaseInstance, IJVMBridgeDefinition, INativeConvertible<String, string>, IComparable<String>, IEquatable<String>, IStringJavaObject
- Inheritance
-
String
- Implements
- Extension Methods
Constructors
String()
public String()
String(String)
public String(String arg0)
Parameters
String(StringBuffer)
public String(StringBuffer arg0)
Parameters
arg0StringBuffer
String(StringBuilder)
public String(StringBuilder arg0)
Parameters
String(IJVMBridgeBaseInitializer)
Initializer used internally by JCOBridge. Do not use directly.
[Obsolete("This public initializer is needed for JCOBridge internal use, other uses can produce unidentible behaviors.")]
public String(IJVMBridgeBaseInitializer initializer)
Parameters
initializerIJVMBridgeBaseInitializer
String(byte[])
public String(byte[] arg0)
Parameters
String(byte[], String)
public String(byte[] arg0, String arg1)
Parameters
Exceptions
String(byte[], Charset)
public String(byte[] arg0, Charset arg1)
Parameters
String(byte[], int)
[Obsolete("Deprecated in JVM")]
public String(byte[] arg0, int arg1)
Parameters
String(byte[], int, int)
public String(byte[] arg0, int arg1, int arg2)
Parameters
String(byte[], int, int, String)
public String(byte[] arg0, int arg1, int arg2, String arg3)
Parameters
Exceptions
String(byte[], int, int, Charset)
public String(byte[] arg0, int arg1, int arg2, Charset arg3)
Parameters
String(byte[], int, int, int)
https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#java.lang.String(byte[],int,int,int)
[Obsolete("Deprecated in JVM")]
public String(byte[] arg0, int arg1, int arg2, int arg3)
Parameters
String(char[])
public String(char[] arg0)
Parameters
String(char[], int, int)
public String(char[] arg0, int arg1, int arg2)
Parameters
String(int[], int, int)
public String(int[] arg0, int arg1, int arg2)
Parameters
String(string)
public String(string arg0)
Parameters
Properties
BridgeClassName
Java class name to be instantiated
public override string BridgeClassName { get; }
Property Value
Bytes
public byte[] Bytes { get; }
Property Value
- byte[]
CASE_INSENSITIVE_ORDER
public static Comparator CASE_INSENSITIVE_ORDER { get; set; }
Property Value
IsBridgeAbstract
true if the BridgeClassName is an abstract class, i.e. cannot be created an instance
public override bool IsBridgeAbstract { get; }
Property Value
IsBridgeCloseable
true if the BridgeClassName implements java.lang.AutoCloseable
public override bool IsBridgeCloseable { get; }
Property Value
IsBridgeInterface
true if the BridgeClassName is an interface, i.e. does not have any public constructor
public override bool IsBridgeInterface { get; }
Property Value
IsBridgeStatic
true if the BridgeClassName is a static class, i.e. does not have any public constructor
public override bool IsBridgeStatic { get; }
Property Value
IsNullOrEmpty
Indicates whether the specified string is null or an Empty string.
public bool IsNullOrEmpty { get; }
Property Value
- bool
true if the
valueparameter is null or an empty string (""); otherwise, false.
Exceptions
- InvalidOperationException
If current instance is not a JVM string
IsNullOrWhiteSpace
Indicates whether a specified string is null, empty, or consists only of white-space characters.
public bool IsNullOrWhiteSpace { get; }
Property Value
- bool
true if the
valueparameter is null or Empty, or ifvalueconsists exclusively of white-space characters.
Exceptions
- InvalidOperationException
If current instance is not a JVM string
this[int]
Returns the character at index
public char this[int index] { get; }
Parameters
indexintThe index of the character to return
Property Value
Methods
CharAt(int)
public char CharAt(int arg0)
Parameters
Returns
CodePointAt(int)
public int CodePointAt(int arg0)
Parameters
Returns
CodePointBefore(int)
public int CodePointBefore(int arg0)
Parameters
Returns
CodePointCount(int, int)
public int CodePointCount(int arg0, int arg1)
Parameters
Returns
CompareTo(String)
public int CompareTo(String arg0)
Parameters
Returns
CompareTo(object)
public int CompareTo(object arg0)
Parameters
Returns
CompareTo(string)
Compares this instance with a specified string object and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified string.
public int CompareTo(string other)
Parameters
otherstring
Returns
- int
A 32-bit signed integer that indicates whether this instance precedes, follows, or appears in the same position in the sort order as the
strBparameter.Value Condition Less than zero This instance precedesstrB. Zero This instance has the same position in the sort order asstrB. Greater than zero This instance followsstrB.-or-strBis null.
Exceptions
- InvalidOperationException
If current instance is not a JVM string
CompareToIgnoreCase(String)
public int CompareToIgnoreCase(String arg0)
Parameters
Returns
Concat(String)
public String Concat(String arg0)
Parameters
Returns
Contains(CharSequence)
public bool Contains(CharSequence arg0)
Parameters
arg0CharSequence
Returns
Contains(char)
Returns a value indicating whether a specified substring occurs within this string.
public bool Contains(char value)
Parameters
valuecharThe string to seek.
Returns
- bool
true if the
valueparameter occurs within this string, or ifvalueis the empty string (""); otherwise, false.
Exceptions
- ArgumentNullException
valueis null.- InvalidOperationException
If current instance is not a JVM string
Contains(string)
Returns a value indicating whether a specified substring occurs within this string.
public bool Contains(string value)
Parameters
valuestringThe string to seek.
Returns
- bool
true if the
valueparameter occurs within this string, or ifvalueis the empty string (""); otherwise, false.
Exceptions
- ArgumentNullException
valueis null.- InvalidOperationException
If current instance is not a JVM string
ContentEquals(CharSequence)
public bool ContentEquals(CharSequence arg0)
Parameters
arg0CharSequence
Returns
ContentEquals(StringBuffer)
public bool ContentEquals(StringBuffer arg0)
Parameters
arg0StringBuffer
Returns
CopyValueOf(char[])
public static String CopyValueOf(char[] arg0)
Parameters
Returns
CopyValueOf(char[], int, int)
public static String CopyValueOf(char[] arg0, int arg1, int arg2)
Parameters
Returns
CreatePoolableInstance()
HPA initializer for String()
public static String CreatePoolableInstance()
Returns
CreatePoolableInstance(String)
HPA initializer for String(Java.Lang.String arg0)
public static String CreatePoolableInstance(String arg0)
Parameters
arg0String
Returns
CreatePoolableInstance(StringBuffer)
HPA initializer for String(Java.Lang.StringBuffer arg0)
public static String CreatePoolableInstance(StringBuffer arg0)
Parameters
arg0StringBuffer
Returns
CreatePoolableInstance(StringBuilder)
HPA initializer for String(Java.Lang.StringBuilder arg0)
public static String CreatePoolableInstance(StringBuilder arg0)
Parameters
arg0StringBuilder
Returns
CreatePoolableInstance(byte[])
HPA initializer for String(byte[] arg0)
public static String CreatePoolableInstance(byte[] arg0)
Parameters
arg0byte[]
Returns
CreatePoolableInstance(byte[], String)
HPA initializer for String(byte[] arg0, Java.Lang.String arg1)
public static String CreatePoolableInstance(byte[] arg0, String arg1)
Parameters
Returns
CreatePoolableInstance(byte[], Charset)
HPA initializer for String(byte[] arg0, Java.Nio.Charset.Charset arg1)
public static String CreatePoolableInstance(byte[] arg0, Charset arg1)
Parameters
Returns
CreatePoolableInstance(byte[], int)
HPA initializer for String(byte[] arg0, int arg1)
public static String CreatePoolableInstance(byte[] arg0, int arg1)
Parameters
Returns
CreatePoolableInstance(byte[], int, int)
HPA initializer for String(byte[] arg0, int arg1, int arg2)
public static String CreatePoolableInstance(byte[] arg0, int arg1, int arg2)
Parameters
Returns
CreatePoolableInstance(byte[], int, int, String)
HPA initializer for String(byte[] arg0, int arg1, int arg2, Java.Lang.String arg3)
public static String CreatePoolableInstance(byte[] arg0, int arg1, int arg2, String arg3)
Parameters
Returns
CreatePoolableInstance(byte[], int, int, Charset)
HPA initializer for String(byte[] arg0, int arg1, int arg2, Java.Nio.Charset.Charset arg3)
public static String CreatePoolableInstance(byte[] arg0, int arg1, int arg2, Charset arg3)
Parameters
Returns
CreatePoolableInstance(byte[], int, int, int)
HPA initializer for String(byte[] arg0, int arg1, int arg2, int arg3)
public static String CreatePoolableInstance(byte[] arg0, int arg1, int arg2, int arg3)
Parameters
Returns
CreatePoolableInstance(char[])
HPA initializer for String(char[] arg0)
public static String CreatePoolableInstance(char[] arg0)
Parameters
arg0char[]
Returns
CreatePoolableInstance(char[], int, int)
HPA initializer for String(char[] arg0, int arg1, int arg2)
public static String CreatePoolableInstance(char[] arg0, int arg1, int arg2)
Parameters
Returns
CreatePoolableInstance(int[], int, int)
HPA initializer for String(int[] arg0, int arg1, int arg2)
public static String CreatePoolableInstance(int[] arg0, int arg1, int arg2)
Parameters
Returns
EndsWith(String)
public bool EndsWith(String arg0)
Parameters
Returns
EndsWith(string)
Determines whether the end of this string instance matches the specified string.
public bool EndsWith(string suffix)
Parameters
suffixstring
Returns
- bool
true if
valuematches the end of this instance; otherwise, false.
Exceptions
- ArgumentNullException
valueis null.- InvalidOperationException
If current instance is not a JVM string
Equals(object)
Determines whether the specified object is equal to the current object.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with the current object.
Returns
- bool
true if the specified object is equal to the current object; otherwise, false.
Equals(string)
Determines whether this instance and another specified string object have the same value.
public bool Equals(string other)
Parameters
otherstring
Returns
- bool
true if the value of the
valueparameter is the same as the value of this instance; otherwise, false. Ifvalueis null, the method returns false.
Exceptions
- InvalidOperationException
If current instance is not a JVM string
EqualsIgnoreCase(String)
public bool EqualsIgnoreCase(String arg0)
Parameters
Returns
Format(String, params object[])
public static String Format(String arg0, params object[] arg1)
Parameters
Returns
Format(Locale, String, params object[])
public static String Format(Locale arg0, String arg1, params object[] arg2)
Parameters
Returns
GetBytes(String)
public byte[] GetBytes(String arg0)
Parameters
Returns
Exceptions
GetBytes(Charset)
public byte[] GetBytes(Charset arg0)
Parameters
Returns
GetBytes(int, int, byte[], int)
[Obsolete("Deprecated in JVM")]
public void GetBytes(int arg0, int arg1, byte[] arg2, int arg3)
Parameters
GetChars(int, int, char[], int)
public void GetChars(int arg0, int arg1, char[] arg2, int arg3)
Parameters
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
IndexOf(String)
public int IndexOf(String arg0)
Parameters
Returns
IndexOf(String, int)
public int IndexOf(String arg0, int arg1)
Parameters
Returns
IndexOf(char)
Reports the zero-based index of the first occurrence of the specified Unicode character in this string.
public int IndexOf(char value)
Parameters
valuecharA Unicode character to seek.
Returns
- int
The zero-based index position of
valueif that character is found, or -1 if it is not.
Exceptions
- InvalidOperationException
If current instance is not a JVM string
IndexOf(int)
public int IndexOf(int arg0)
Parameters
Returns
IndexOf(int, int)
public int IndexOf(int arg0, int arg1)
Parameters
Returns
IndexOf(string)
Reports the zero-based index of the first occurrence of the specified string in this instance.
public int IndexOf(string value)
Parameters
valuestringThe string to seek.
Returns
- int
The zero-based index position of
valueif that string is found, or -1 if it is not. Ifvalueis Empty, the return value is 0.
Exceptions
- ArgumentNullException
valueis null.- InvalidOperationException
If current instance is not a JVM string
IndexOfAny(char[])
Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode characters.
public int IndexOfAny(char[] values)
Parameters
valueschar[]
Returns
- int
The zero-based index position of the first occurrence in this instance where any character in
anyOfwas found; -1 if no character inanyOfwas found.
Exceptions
- ArgumentNullException
anyOfis null.- InvalidOperationException
If current instance is not a JVM string
Intern()
public String Intern()
Returns
IsEmpty()
public bool IsEmpty()
Returns
Join(CharSequence, params CharSequence[])
public static String Join(CharSequence arg0, params CharSequence[] arg1)
Parameters
arg0CharSequencearg1CharSequence[]
Returns
Join<Arg1ExtendsJava_Lang_CharSequence>(CharSequence, Iterable<Arg1ExtendsJava_Lang_CharSequence>)
public static String Join<Arg1ExtendsJava_Lang_CharSequence>(CharSequence arg0, Iterable<Arg1ExtendsJava_Lang_CharSequence> arg1) where Arg1ExtendsJava_Lang_CharSequence : CharSequence
Parameters
arg0CharSequencearg1Iterable<Arg1ExtendsJava_Lang_CharSequence>
Returns
Type Parameters
Arg1ExtendsJava_Lang_CharSequence
LastIndexOf(String)
public int LastIndexOf(String arg0)
Parameters
Returns
LastIndexOf(String, int)
public int LastIndexOf(String arg0, int arg1)
Parameters
Returns
LastIndexOf(char)
Reports the zero-based index position of the last occurrence of a specified Unicode character within this instance.
public int LastIndexOf(char value)
Parameters
valuecharThe Unicode character to seek.
Returns
- int
The zero-based index position of
valueif that character is found, or -1 if it is not.
Exceptions
- InvalidOperationException
If current instance is not a JVM string
LastIndexOf(int)
public int LastIndexOf(int arg0)
Parameters
Returns
LastIndexOf(int, int)
public int LastIndexOf(int arg0, int arg1)
Parameters
Returns
LastIndexOf(string)
Reports the zero-based index position of the last occurrence of a specified string within this instance.
public int LastIndexOf(string value)
Parameters
valuestringThe string to seek.
Returns
- int
The zero-based starting index position of
valueif that string is found, or -1 if it is not. Ifvalueis Empty, the return value is the last index position in this instance.
Exceptions
- ArgumentNullException
valueis null.- InvalidOperationException
If current instance is not a JVM string
LastIndexOfAny(char[])
Reports the zero-based index position of the last occurrence in this instance of one or more characters specified in a Unicode array.
public int LastIndexOfAny(char[] values)
Parameters
valueschar[]
Returns
- int
The index position of the last occurrence in this instance where any character in
anyOfwas found; -1 if no character inanyOfwas found.
Exceptions
- ArgumentNullException
anyOfis null.- InvalidOperationException
If current instance is not a JVM string
Length()
public int Length()
Returns
Matches(String)
public bool Matches(String arg0)
Parameters
Returns
OffsetByCodePoints(int, int)
public int OffsetByCodePoints(int arg0, int arg1)
Parameters
Returns
RegionMatches(bool, int, String, int, int)
public bool RegionMatches(bool arg0, int arg1, String arg2, int arg3, int arg4)
Parameters
Returns
RegionMatches(int, String, int, int)
public bool RegionMatches(int arg0, String arg1, int arg2, int arg3)
Parameters
Returns
Replace(CharSequence, CharSequence)
public String Replace(CharSequence arg0, CharSequence arg1)
Parameters
arg0CharSequencearg1CharSequence
Returns
Replace(char, char)
public String Replace(char arg0, char arg1)
Parameters
Returns
ReplaceAll(String, String)
public String ReplaceAll(String arg0, String arg1)
Parameters
Returns
ReplaceFirst(String, String)
public String ReplaceFirst(String arg0, String arg1)
Parameters
Returns
Split(String)
public String[] Split(String arg0)
Parameters
Returns
Split(String, int)
public String[] Split(String arg0, int arg1)
Parameters
Returns
StartsWith(String)
public bool StartsWith(String arg0)
Parameters
Returns
StartsWith(String, int)
public bool StartsWith(String arg0, int arg1)
Parameters
Returns
StartsWith(string)
Determines whether the beginning of this string instance matches the specified string.
public bool StartsWith(string prefix)
Parameters
prefixstring
Returns
- bool
true if
valuematches the beginning of this string; otherwise, false.
Exceptions
- ArgumentNullException
valueis null.- InvalidOperationException
If current instance is not a JVM string
SubSequence(int, int)
public CharSequence SubSequence(int arg0, int arg1)
Parameters
Returns
Substring(int)
public String Substring(int arg0)
Parameters
Returns
Substring(int, int)
public String Substring(int arg0, int arg1)
Parameters
Returns
ToCharArray()
public char[] ToCharArray()
Returns
ToJVM(string)
Returns the String from the clrValue instance
public static String ToJVM(string clrValue)
Parameters
Returns
ToLowerCase()
public String ToLowerCase()
Returns
ToLowerCase(Locale)
public String ToLowerCase(Locale arg0)
Parameters
Returns
ToUpperCase()
public String ToUpperCase()
Returns
ToUpperCase(Locale)
public String ToUpperCase(Locale arg0)
Parameters
Returns
Trim()
public String Trim()
Returns
ValueOf(bool)
public static String ValueOf(bool arg0)
Parameters
Returns
ValueOf(char)
public static String ValueOf(char arg0)
Parameters
Returns
ValueOf(char[])
public static String ValueOf(char[] arg0)
Parameters
Returns
ValueOf(char[], int, int)
public static String ValueOf(char[] arg0, int arg1, int arg2)
Parameters
Returns
ValueOf(double)
public static String ValueOf(double arg0)
Parameters
Returns
ValueOf(int)
public static String ValueOf(int arg0)
Parameters
Returns
ValueOf(long)
public static String ValueOf(long arg0)
Parameters
Returns
ValueOf(object)
public static String ValueOf(object arg0)
Parameters
Returns
ValueOf(float)
public static String ValueOf(float arg0)
Parameters
Returns
Operators
operator +(String, String)
Binary operator managing concatanation within JVM
public static String operator +(String a, String b)
Parameters
Returns
Remarks
This overload can be very helpful because it avoids to move string contant from JVM to .NET and viceversa
operator ==(String, String)
Checks equality between two String instances.
public static bool operator ==(String left, String right)
Parameters
Returns
operator ==(String, string)
public static bool operator ==(String left, string right)
Parameters
Returns
operator ==(string, String)
public static bool operator ==(string left, String right)
Parameters
Returns
implicit operator Serializable(String)
Converter from String to Serializable
public static implicit operator Serializable(String t)
Parameters
tString
Returns
implicit operator CharSequence(String)
Converter from String to CharSequence
public static implicit operator CharSequence(String t)
Parameters
tString
Returns
implicit operator Comparable(String)
Converter from String to Comparable
public static implicit operator Comparable(String t)
Parameters
tString
Returns
implicit operator string(String)
public static implicit operator string(String b)
Parameters
bString
Returns
implicit operator String(string)
public static implicit operator String(string b)
Parameters
bstring
Returns
operator !=(String, String)
Checks inequality between two String instances.
public static bool operator !=(String left, String right)
Parameters
Returns
operator !=(String, string)
public static bool operator !=(String left, string right)
Parameters
Returns
operator !=(string, String)
public static bool operator !=(string left, String right)