Table of Contents

Interface IStringJavaObject

Namespace
MASES.JCOBridge.C2JBridge.JVMInterop
Assembly
C2JBridge.dll

Interface to manage JVM string objects without move the memory between CLR and JVM

public interface IStringJavaObject
Extension Methods

Properties

IsNullOrEmpty

Indicates whether the specified string is null or an Empty string.

bool IsNullOrEmpty { get; }

Property Value

bool

true if the value parameter 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.

bool IsNullOrWhiteSpace { get; }

Property Value

bool

true if the value parameter is null or Empty, or if value consists exclusively of white-space characters.

Exceptions

InvalidOperationException

If current instance is not a JVM string

Methods

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.

int CompareTo(string strB)

Parameters

strB string

The string to compare with this instance.

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 strB parameter.Value Condition Less than zero This instance precedes strB. Zero This instance has the same position in the sort order as strB. Greater than zero This instance follows strB.-or- strB is null.

Exceptions

InvalidOperationException

If current instance is not a JVM string

Contains(char)

Returns a value indicating whether a specified substring occurs within this string.

bool Contains(char value)

Parameters

value char

The string to seek.

Returns

bool

true if the value parameter occurs within this string, or if value is the empty string (""); otherwise, false.

Exceptions

ArgumentNullException

value is null.

InvalidOperationException

If current instance is not a JVM string

Contains(string)

Returns a value indicating whether a specified substring occurs within this string.

bool Contains(string value)

Parameters

value string

The string to seek.

Returns

bool

true if the value parameter occurs within this string, or if value is the empty string (""); otherwise, false.

Exceptions

ArgumentNullException

value is null.

InvalidOperationException

If current instance is not a JVM string

EndsWith(string)

Determines whether the end of this string instance matches the specified string.

bool EndsWith(string value)

Parameters

value string

The string to compare to the substring at the end of this instance.

Returns

bool

true if value matches the end of this instance; otherwise, false.

Exceptions

ArgumentNullException

value is null.

InvalidOperationException

If current instance is not a JVM string

Equals(string)

Determines whether this instance and another specified string object have the same value.

bool Equals(string value)

Parameters

value string

The string to compare to this instance.

Returns

bool

true if the value of the value parameter is the same as the value of this instance; otherwise, false. If value is null, the method returns false.

Exceptions

InvalidOperationException

If current instance is not a JVM string

IndexOf(char)

Reports the zero-based index of the first occurrence of the specified Unicode character in this string.

int IndexOf(char value)

Parameters

value char

A Unicode character to seek.

Returns

int

The zero-based index position of value if that character is found, or -1 if it is not.

Exceptions

InvalidOperationException

If current instance is not a JVM string

IndexOf(string)

Reports the zero-based index of the first occurrence of the specified string in this instance.

int IndexOf(string value)

Parameters

value string

The string to seek.

Returns

int

The zero-based index position of value if that string is found, or -1 if it is not. If value is Empty, the return value is 0.

Exceptions

ArgumentNullException

value is 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.

int IndexOfAny(char[] anyOf)

Parameters

anyOf char[]

A Unicode character array containing one or more characters to seek.

Returns

int

The zero-based index position of the first occurrence in this instance where any character in anyOf was found; -1 if no character in anyOf was found.

Exceptions

ArgumentNullException

anyOf is null.

InvalidOperationException

If current instance is not a JVM string

LastIndexOf(char)

Reports the zero-based index position of the last occurrence of a specified Unicode character within this instance.

int LastIndexOf(char value)

Parameters

value char

The Unicode character to seek.

Returns

int

The zero-based index position of value if that character is found, or -1 if it is not.

Exceptions

InvalidOperationException

If current instance is not a JVM string

LastIndexOf(string)

Reports the zero-based index position of the last occurrence of a specified string within this instance.

int LastIndexOf(string value)

Parameters

value string

The string to seek.

Returns

int

The zero-based starting index position of value if that string is found, or -1 if it is not. If value is Empty, the return value is the last index position in this instance.

Exceptions

ArgumentNullException

value is 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.

int LastIndexOfAny(char[] anyOf)

Parameters

anyOf char[]

A Unicode character array containing one or more characters to seek.

Returns

int

The index position of the last occurrence in this instance where any character in anyOf was found; -1 if no character in anyOf was found.

Exceptions

ArgumentNullException

anyOf is null.

InvalidOperationException

If current instance is not a JVM string

StartsWith(string)

Determines whether the beginning of this string instance matches the specified string.

bool StartsWith(string value)

Parameters

value string

The string to compare.

Returns

bool

true if value matches the beginning of this string; otherwise, false.

Exceptions

ArgumentNullException

value is null.

InvalidOperationException

If current instance is not a JVM string