## 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

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

Append part of the character sequence to the given string buffer.
This method is no longer needed in JDK 1.5 where the implementation of the same functionality is available in the StringBuffer directly.

### Parameters

sb - a StringBuffer
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]

## 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

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

Append the character description to the given string builder 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

debugChar( char ch ) → String

Return the text description of the given character translating the special characters (and '\') into escape sequences.

### Parameters

ch - char to debug.

### Returns:

non-null debug text.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## 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

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

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

### Parameters

sb - non-null string builder 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

debugText( java.lang.CharSequence text ) → String

Create text description as String translating the special characters (and '\') into escape sequences.

### Parameters

text - non-null text to be debugged.

### Returns:

non-null string containing the debug text.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## 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

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

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

### Parameters

text - a CharSequence
ch - an int
fromIndex - an int

### Returns:

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

## indexOf

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

Implementation of {@link String#indexOf(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]

## indexOf

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

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

### Parameters

text - a CharSequence
seq - a CharSequence
fromIndex - an int

### Returns:

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

## 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

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

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

### Parameters

text - a CharSequence
seq - a CharSequence
fromIndex - an int

### Returns:

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

## lastIndexOf

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

Implementation of {@link String#lastIndexOf(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]

## lastIndexOf

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

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

### Parameters

text - a CharSequence
ch - an int
fromIndex - an int

### Returns:

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

## 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

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

Create string for the given portion of the character sequence.

### Parameters

text - non-null text.
start - >=0 and end - >=start and Returns: java.lang.String
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## trim

trim( java.lang.CharSequence text ) → java.lang.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]