Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.gjt.sp.jedit
Class TextUtilities  view TextUtilities download TextUtilities.java

java.lang.Object
  extended byorg.gjt.sp.jedit.TextUtilities

public class TextUtilities
extends java.lang.Object

Contains several text manipulation methods.

Version:
$Id: TextUtilities.java,v 1.46 2003/08/25 20:59:10 spestov Exp $

Field Summary
static int BRACKET_MATCH_LIMIT
           
static int LOWER_CASE
           
static int MIXED
           
private static int SYMBOL
           
static int TITLE_CASE
           
static int UPPER_CASE
           
private static int WHITESPACE
           
private static int WORD_CHAR
           
 
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 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 findWordEnd(java.lang.String line, int pos, java.lang.String noWordSep, boolean joinNonWordChars, boolean eatWhitespace)
          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 int findWordStart(java.lang.String line, int pos, java.lang.String noWordSep, boolean joinNonWordChars, boolean eatWhitespace)
          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.
private static void formatParagraph(java.lang.String text, int maxLineLength, int tabSize, java.lang.StringBuffer buf)
           
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 org.gjt.sp.jedit.syntax.Token getTokenAtOffset(org.gjt.sp.jedit.syntax.Token tokens, int offset)
          Returns the token that contains the specified offset.
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

BRACKET_MATCH_LIMIT

public static final int BRACKET_MATCH_LIMIT
See Also:
Constant Field Values

MIXED

public static final int MIXED
See Also:
Constant Field Values

LOWER_CASE

public static final int LOWER_CASE
See Also:
Constant Field Values

UPPER_CASE

public static final int UPPER_CASE
See Also:
Constant Field Values

TITLE_CASE

public static final int TITLE_CASE
See Also:
Constant Field Values

WHITESPACE

private static final int WHITESPACE
See Also:
Constant Field Values

WORD_CHAR

private static final int WORD_CHAR
See Also:
Constant Field Values

SYMBOL

private static final int SYMBOL
See Also:
Constant Field Values
Constructor Detail

TextUtilities

public TextUtilities()
Method Detail

getTokenAtOffset

public static org.gjt.sp.jedit.syntax.Token getTokenAtOffset(org.gjt.sp.jedit.syntax.Token tokens,
                                                             int offset)
Returns the token that contains the specified offset.

Since:
jEdit 4.0pre3

findMatchingBracket

public 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).

Since:
jEdit 2.6pre1

findWordStart

public static int findWordStart(java.lang.String line,
                                int pos,
                                java.lang.String noWordSep)
Locates the start of the word at the specified position.


findWordStart

public 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.

Since:
jEdit 4.2pre5

findWordStart

public static int findWordStart(java.lang.String line,
                                int pos,
                                java.lang.String noWordSep,
                                boolean joinNonWordChars,
                                boolean eatWhitespace)
Locates the start of the word at the specified position.

Since:
jEdit 4.1pre2

findWordEnd

public static int findWordEnd(java.lang.String line,
                              int pos,
                              java.lang.String noWordSep)
Locates the end of the word at the specified position.


findWordEnd

public 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.

Since:
jEdit 4.1pre2

findWordEnd

public static int findWordEnd(java.lang.String line,
                              int pos,
                              java.lang.String noWordSep,
                              boolean joinNonWordChars,
                              boolean eatWhitespace)
Locates the end of the word at the specified position.

Since:
jEdit 4.2pre5

spacesToTabs

public static java.lang.String spacesToTabs(java.lang.String in,
                                            int tabSize)
Converts consecutive spaces to tabs in the specified string.


tabsToSpaces

public static java.lang.String tabsToSpaces(java.lang.String in,
                                            int tabSize)
Converts tabs to consecutive spaces in the specified string.


format

public 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.


getStringCase

public 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).

Since:
jEdit 4.0pre1

toTitleCase

public static java.lang.String toTitleCase(java.lang.String str)
Converts the specified string to title case, by capitalizing the first letter.

Since:
jEdit 4.0pre1

formatParagraph

private static void formatParagraph(java.lang.String text,
                                    int maxLineLength,
                                    int tabSize,
                                    java.lang.StringBuffer buf)