public class TextUtilities
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
BACKWARD |
static java.lang.String |
BRACKETS |
static int |
FORWARD |
Constructor and Description |
---|
TextUtilities() |
Modifier and Type | Method and Description |
---|---|
static int |
findMatchingBracket(SyntaxDocument doc,
int offset)
Returns the offset of the bracket matching the one at the
specified offset of the document, or -1 if the bracket is
unmatched (or if the character is not a bracket).
|
static int |
findTypeChange(java.lang.String line,
int pos,
int direction)
Locates the next character type change searching in the specified direction.
|
static int |
findWordEnd(java.lang.String line,
int pos,
java.lang.String noWordSep)
Locates the end of the word at the specified position.
|
static int |
findWordStart(java.lang.String line,
int pos,
java.lang.String noWordSep)
Locates the start of the word at the specified position.
|
public static final java.lang.String BRACKETS
public static final int FORWARD
public static final int BACKWARD
public static int findMatchingBracket(SyntaxDocument doc, int offset) throws javax.swing.text.BadLocationException
doc
- The documentoffset
- The offsetjavax.swing.text.BadLocationException
- If an out-of-bounds access
was attempted on the document textpublic static int findWordStart(java.lang.String line, int pos, java.lang.String noWordSep)
line
- The textpos
- The positionnoWordSep
- Characters that are non-alphanumeric, but
should be treated as word characters anywaypublic static int findWordEnd(java.lang.String line, int pos, java.lang.String noWordSep)
line
- The textpos
- The positionnoWordSep
- Characters that are non-alphanumeric, but
should be treated as word characters anywaypublic static int findTypeChange(java.lang.String line, int pos, int direction)
line
- The text.pos
- The position.direction
- The direction in which the search should be made.Copyright ? 2002 Romain Guy.