ptolemy.gui
Class GUIStringUtilities
java.lang.Object
|
+--ptolemy.gui.GUIStringUtilities
- public class GUIStringUtilities
- extends java.lang.Object
A collection of utilities for manipulating strings.
In theory, these methods should be in
ptolemy.kernel.util.StringUtilities
, but ptolemy.gui gets shipped
without StringUtilities, so we include them here.
- Since:
- Ptolemy II 2.0
- Version:
- $Id: GUIStringUtilities.java,v 1.6 2002/05/07 22:51:25 cxh Exp $
- Author:
- Christopher Hylands
Method Summary |
static java.lang.String |
abbreviate(java.lang.String longName)
Abbreviate a string. |
static java.lang.String |
split(java.lang.String longName)
If the string is longer than 80 characters, split it up by
displaying adding newlines every 80 characters. |
static java.lang.String[] |
tokenizeForExec(java.lang.String inputString)
Tokenize a String to an array of Strings for use with
Runtime.exec(String []). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
abbreviate
public static java.lang.String abbreviate(java.lang.String longName)
- Abbreviate a string.
If the string is longer than 80 characters, truncate it by
displaying the first 37 chars, then ". . .", then the last 38
characters.
If the longName argument is null, then the string
"" is returned.
- Returns:
- The name.
- See Also:
split(String longName)
split
public static java.lang.String split(java.lang.String longName)
- If the string is longer than 80 characters, split it up by
displaying adding newlines every 80 characters.
If the longName argument is null, then the string
"" is returned.
- Parameters:
longName
- The string to optionally split up- Returns:
- Either the original string, or the string with newlines
inserted
- See Also:
abbreviate(java.lang.String)
tokenizeForExec
public static java.lang.String[] tokenizeForExec(java.lang.String inputString)
throws java.io.IOException
- Tokenize a String to an array of Strings for use with
Runtime.exec(String []).
Lines that begin with an octothorpe '#' are ignored.
Substrings that start and end with a double quote are considered
to be a single token and are returned as a single array element.
- Parameters:
inputString
- The String to tokenize- Returns:
- An array of substrings.
- Throws:
java.io.IOException
- Thrown if StreamTokenizer.nextToken() throws it.