|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.gjt.sp.jedit.TextUtilities
Contains several text manipulation methods.
Field Summary | |
static int |
LOWER_CASE
|
static int |
MIXED
|
static int |
TITLE_CASE
|
static int |
UPPER_CASE
|
Constructor Summary | |
TextUtilities()
|
Method Summary | |
static int |
findMatchingBracket(Buffer buffer,
int line,
int offset)
Returns the offset of the bracket matching the one at the specified offset of the buffer, or -1 if the bracket is unmatched (or if the character is not a bracket). |
static int |
findMatchingBracketFuzzy(Buffer buffer,
int line,
int offset)
Works exactly like the findMatchingBracket(Bufferm int, int) method, but if there is no (matching) bracket at the specified offset, it looks at the next character too. |
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 |
findWordEnd(java.lang.String line,
int pos,
java.lang.String noWordSep,
boolean joinNonWordChars)
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. |
static int |
findWordStart(java.lang.String line,
int pos,
java.lang.String noWordSep,
boolean joinNonWordChars)
Locates the start of the word at the specified position. |
static java.lang.String |
format(java.lang.String text,
int maxLineLength,
int tabSize)
Formats the specified text by merging and breaking lines to the specified width. |
static int |
getStringCase(java.lang.String str)
Returns if the specified string is all upper case, all lower case, or title case (first letter upper case, rest lower case). |
static Token |
getTokenAtOffset(Token tokens,
int offset)
Returns the token that contains the specified offset. |
static boolean |
regionMatches(boolean ignoreCase,
javax.swing.text.Segment text,
int offset,
char[] match)
Checks if a subregion of a Segment is equal to a
character array. |
static java.lang.String |
spacesToTabs(java.lang.String in,
int tabSize)
Converts consecutive spaces to tabs in the specified string. |
static java.lang.String |
tabsToSpaces(java.lang.String in,
int tabSize)
Converts tabs to consecutive spaces in the specified string. |
static java.lang.String |
toTitleCase(java.lang.String str)
Converts the specified string to title case, by capitalizing the first letter. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int MIXED
public static final int LOWER_CASE
public static final int UPPER_CASE
public static final int TITLE_CASE
Constructor Detail |
public TextUtilities()
Method Detail |
public static Token getTokenAtOffset(Token tokens, int offset)
tokens
- The token listoffset
- The offsetpublic static int findMatchingBracket(Buffer buffer, int line, int offset)
buffer
- The bufferline
- The lineoffset
- The offset within that linepublic static int findMatchingBracketFuzzy(Buffer buffer, int line, int offset)
buffer
- The bufferline
- The lineoffset
- The offset within that linepublic 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 findWordStart(java.lang.String line, int pos, java.lang.String noWordSep, boolean joinNonWordChars)
line
- The textpos
- The positionnoWordSep
- Characters that are non-alphanumeric, but
should be treated as word characters anywayjoinNonWordChars
- Treat consecutive non-alphanumeric
characters as one wordpublic 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 findWordEnd(java.lang.String line, int pos, java.lang.String noWordSep, boolean joinNonWordChars)
line
- The textpos
- The positionnoWordSep
- Characters that are non-alphanumeric, but
should be treated as word characters anywayjoinNonWordChars
- Treat consecutive non-alphanumeric
characters as one wordpublic static boolean regionMatches(boolean ignoreCase, javax.swing.text.Segment text, int offset, char[] match)
Segment
is equal to a
character array.
ignoreCase
- True if case should be ignored, false otherwisetext
- The segmentoffset
- The offset into the segmentmatch
- The character array to matchpublic static java.lang.String spacesToTabs(java.lang.String in, int tabSize)
in
- The stringtabSize
- The tab sizepublic static java.lang.String tabsToSpaces(java.lang.String in, int tabSize)
in
- The stringtabSize
- The tab sizepublic static java.lang.String format(java.lang.String text, int maxLineLength, int tabSize)
text
- The textpublic static int getStringCase(java.lang.String str)
str
- The stringpublic static java.lang.String toTitleCase(java.lang.String str)
str
- The string
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |