org.das2.jythoncompletion.nbadapt.CharSequenceUtilities

Utility methods related to character sequences.


append

append( java.lang.StringBuffer sb, java.lang.CharSequence text ) → void

Append character sequence to the given string buffer.
This method is no longer needed in JDK 1.5 where the implementation does not create an extra java.lang.String instance.

Parameters

sb - a StringBuffer
text - a CharSequence

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]

append( java.lang.StringBuffer sb, java.lang.CharSequence text, int start, int end ) → void

checkIndexNonNegative

checkIndexNonNegative( int index ) → void

Ensure that the given index is >=0 and lower than the given length.

Parameters

index - an int

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]


checkIndexValid

checkIndexValid( int index, int length ) → void

Ensure that the given index is >=0 and lower than the given length.

Parameters

index - an int
length - an int

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]


checkIndexesValid

checkIndexesValid( java.lang.CharSequence text, int start, int end ) → void

Ensure that the given start and end parameters are valid indices of the given text.

Parameters

text - a CharSequence
start - an int
end - an int

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]


debugChar

debugChar( java.lang.StringBuffer sb, char ch ) → void

Append the character description to the given string buffer translating the special characters (and '\') into escape sequences.

Parameters

sb - non-null string buffer to append to.
ch - character to be debugged.

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]

debugChar( java.lang.StringBuilder sb, char ch ) → void
debugChar( char ch ) → String

debugText

debugText( java.lang.StringBuffer sb, java.lang.CharSequence text ) → void

Append the text description to the given string buffer translating the special characters (and '\') into escape sequences.

Parameters

sb - non-null string buffer to append to.
text - non-null text to be debugged.

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]

debugText( java.lang.StringBuilder sb, java.lang.CharSequence text ) → void
debugText( java.lang.CharSequence text ) → String

endsWith

endsWith( java.lang.CharSequence text, java.lang.CharSequence suffix ) → boolean

Implementation of {@link String#endsWith(String)} for character sequences.

Parameters

text - a CharSequence
suffix - a CharSequence

Returns:

boolean

[search for examples] [view on GitHub] [view on old javadoc] [view source]


equals

equals( java.lang.CharSequence text, Object o ) → boolean

Compare character sequence to another object. The match is successful if the second object is a character sequence as well and both character sequences contain the same characters (or if both objects are null).

Parameters

text - character sequence being compared to the given object. It may be null.
o - object to be compared to the character sequence. It may be null.

Returns:

true if both parameters are null or both are non-null and they contain the same text.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


indexOf

indexOf( java.lang.CharSequence text, int ch ) → int

Implementation of {@link String#indexOf(int)} for character sequences.

Parameters

text - a CharSequence
ch - an int

Returns:

int

[search for examples] [view on GitHub] [view on old javadoc] [view source]

indexOf( java.lang.CharSequence text, int ch, int fromIndex ) → int
indexOf( java.lang.CharSequence text, java.lang.CharSequence seq ) → int
indexOf( java.lang.CharSequence text, java.lang.CharSequence seq, int fromIndex ) → int

lastIndexOf

lastIndexOf( java.lang.CharSequence text, java.lang.CharSequence seq ) → int

Implementation of {@link String#lastIndexOf(String)} for character sequences.

Parameters

text - a CharSequence
seq - a CharSequence

Returns:

int

[search for examples] [view on GitHub] [view on old javadoc] [view source]

lastIndexOf( java.lang.CharSequence text, java.lang.CharSequence seq, int fromIndex ) → int
lastIndexOf( java.lang.CharSequence text, int ch ) → int
lastIndexOf( java.lang.CharSequence text, int ch, int fromIndex ) → int

startsWith

startsWith( java.lang.CharSequence text, java.lang.CharSequence prefix ) → boolean

Implementation of {@link String#startsWith(String)} for character sequences.

Parameters

text - a CharSequence
prefix - a CharSequence

Returns:

boolean

[search for examples] [view on GitHub] [view on old javadoc] [view source]


stringLikeHashCode

stringLikeHashCode( java.lang.CharSequence text ) → int

Compute {@link String}-like hashcode over given {@link CharSequence}.

Parameters

text - character sequence for which the hashcode is being computed.

Returns:

hashcode of the given character sequence.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


textEquals

textEquals( java.lang.CharSequence text1, java.lang.CharSequence text2 ) → boolean

Test whether whether the given character sequences represent the same text.
The match is successful if the contained characters of the two character sequences are the same.

Parameters

text1 - first character sequence being compared. It must not be null.
text2 - second character sequence being compared. It must not be null.

Returns:

true if both parameters are equal in String-like manner.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


toString

toString( java.lang.CharSequence text ) → String

Create a string from the given character sequence by first creating a StringBuilder and appending the whole character sequence to it.
The method does not call toString() on the given character sequence.

Parameters

text - character sequence for which the String form should be created.

Returns:

string representation of the character sequence.

[search for examples] [view on GitHub] [view on old javadoc] [view source]

toString( java.lang.CharSequence text, int start, int end ) → String

trim

trim( java.lang.CharSequence text ) → CharSequence

Implementation of {@link String#trim()} for character sequences.

Parameters

text - a CharSequence

Returns:

java.lang.CharSequence

[search for examples] [view on GitHub] [view on old javadoc] [view source]