| java.lang.Object org.gjt.sp.util.StandardUtilities
StandardUtilities | public class StandardUtilities (Code) | | Several tools that depends on JDK only.
author: Matthieu Casanova version: $Id: StandardUtilities.java 9871 2007-06-28 16:33:20Z Vampire0 $ since: 4.3pre5 |
Inner Class :public static class StringCompare implements Comparator | |
Method Summary | |
public static int | compareStrings(String str1, String str2, boolean ignoreCase) Compares two strings.
Unlike String.compareTo(),
this method correctly recognizes and handles embedded numbers. | public static String | createWhiteSpace(int len, int tabSize) | public static String | createWhiteSpace(int len, int tabSize, int start) | public static String | getIndentString(String str) | public static int | getLeadingWhiteSpace(String str) Returns the number of leading white space characters in the
specified string. | public static int | getLeadingWhiteSpaceWidth(String str, int tabSize) Returns the width of the leading white space in the specified
string. | public static int | getOffsetOfVirtualColumn(Segment seg, int tabSize, int column, int[] totalVirtualWidth) Returns the array offset of a virtual column number (taking tabs
into account) in the segment.
Parameters: seg - The segment Parameters: tabSize - The tab size Parameters: column - The virtual column number Parameters: totalVirtualWidth - If this array is non-null, the totalvirtual width will be stored in its first location if this methodreturns -1. | public static int | getTrailingWhiteSpace(String str) Returns the number of trailing whitespace characters in the
specified string. | public static int | getVirtualWidth(Segment seg, int tabSize) Returns the virtual column number (taking tabs into account) of the
specified offset in the segment. | public static String | globToRE(String glob) Converts a Unix-style glob to a regular expression.
? becomes ., * becomes .*, {aa,bb} becomes (aa|bb). | public static boolean | objectsEqual(Object o1, Object o2) Returns if two strings are equal. |
compareStrings | public static int compareStrings(String str1, String str2, boolean ignoreCase)(Code) | | Compares two strings.
Unlike String.compareTo(),
this method correctly recognizes and handles embedded numbers.
For example, it places "My file 2" before "My file 10".
Parameters: str1 - The first string Parameters: str2 - The second string Parameters: ignoreCase - If true, case will be ignored negative If str1 < str2, 0 if both are the same,positive if str1 > str2 since: jEdit 4.3pre5 |
createWhiteSpace | public static String createWhiteSpace(int len, int tabSize)(Code) | | Creates a string of white space with the specified length.
To get a whitespace string tuned to the current buffer's
settings, call this method as follows:
myWhitespace = MiscUtilities.createWhiteSpace(myLength,
(buffer.getBooleanProperty("noTabs") ? 0
: buffer.getTabSize()));
Parameters: len - The length Parameters: tabSize - The tab size, or 0 if tabs are not to be used |
createWhiteSpace | public static String createWhiteSpace(int len, int tabSize, int start)(Code) | | Creates a string of white space with the specified length.
To get a whitespace string tuned to the current buffer's
settings, call this method as follows:
myWhitespace = MiscUtilities.createWhiteSpace(myLength,
(buffer.getBooleanProperty("noTabs") ? 0
: buffer.getTabSize()));
Parameters: len - The length Parameters: tabSize - The tab size, or 0 if tabs are not to be used Parameters: start - The start offset, for tab alignment |
getIndentString | public static String getIndentString(String str)(Code) | | Parameters: str - A java string the leading whitespace of that string, for indenting subsequent lines. since: jEdit 4.3pre10 |
getLeadingWhiteSpace | public static int getLeadingWhiteSpace(String str)(Code) | | Returns the number of leading white space characters in the
specified string.
Parameters: str - The string |
getLeadingWhiteSpaceWidth | public static int getLeadingWhiteSpaceWidth(String str, int tabSize)(Code) | | Returns the width of the leading white space in the specified
string.
Parameters: str - The string Parameters: tabSize - The tab size |
getOffsetOfVirtualColumn | public static int getOffsetOfVirtualColumn(Segment seg, int tabSize, int column, int[] totalVirtualWidth)(Code) | | Returns the array offset of a virtual column number (taking tabs
into account) in the segment.
Parameters: seg - The segment Parameters: tabSize - The tab size Parameters: column - The virtual column number Parameters: totalVirtualWidth - If this array is non-null, the totalvirtual width will be stored in its first location if this methodreturns -1. -1 if the column is out of bounds |
getTrailingWhiteSpace | public static int getTrailingWhiteSpace(String str)(Code) | | Returns the number of trailing whitespace characters in the
specified string.
Parameters: str - The string |
getVirtualWidth | public static int getVirtualWidth(Segment seg, int tabSize)(Code) | | Returns the virtual column number (taking tabs into account) of the
specified offset in the segment.
Parameters: seg - The segment Parameters: tabSize - The tab size |
globToRE | public static String globToRE(String glob)(Code) | | Converts a Unix-style glob to a regular expression.
? becomes ., * becomes .*, {aa,bb} becomes (aa|bb).
Parameters: glob - The glob pattern since: jEdit 4.3pre7 |
objectsEqual | public static boolean objectsEqual(Object o1, Object o2)(Code) | | Returns if two strings are equal. This correctly handles null pointers,
as opposed to calling o1.equals(o2) .
since: jEdit 4.3pre6 |
|
|