psdi.webclient.applet.wfcanvas.util

Class StringTools

  • java.lang.Object
    • psdi.webclient.applet.wfcanvas.util.StringTools


  • public class StringTools
    extends java.lang.Object
    This utility class provides methods for processing strings. Currently, it supports a backslash conversion and a word wrap methods.
    • Constructor Summary

      Constructors 
      Constructor and Description
      StringTools() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static boolean areWordsInString(java.lang.String[] words, java.lang.String str, int flags) 
      static java.util.Vector btokenize(java.lang.String str, char separator) 
      static java.util.Vector btokenizeEx(java.lang.String str, char separator)
      This method tokenizes the given string, using the separator character as the tokenizing delimiter.
      static java.lang.String convertDoubleSlash(java.lang.String str) 
      static java.lang.String convertSingleSlash(java.lang.String str) 
      static java.lang.String format(java.lang.String pattern, java.lang.Object[] arguments)
      This routine jackets java.text.MessageFormat.format() and hides the fact that that routine destroys apostrophes, and turns double and triple apostrophes into single apostrophes.
      static java.lang.String[] getWordList(java.lang.String str) 
      static java.lang.String replaceText(java.lang.String content, java.lang.String pattern, java.lang.String replace)
      Replaces all occurrances of the pattern in the content string with the given replace text.
      static java.lang.String testCharacters(java.lang.String str, java.lang.String chars) 
      static java.lang.String[] wordWrapString(java.lang.String str, java.awt.FontMetrics metrics, int maxWidth)
      Breaks up a long string into multiple Strings between words to fit in a graphical area of a specified font & width.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StringTools

        public StringTools()
    • Method Detail

      • areWordsInString

        public static boolean areWordsInString(java.lang.String[] words,
                                               java.lang.String str,
                                               int flags)
      • btokenize

        public static java.util.Vector btokenize(java.lang.String str,
                                                 char separator)
      • btokenizeEx

        public static java.util.Vector btokenizeEx(java.lang.String str,
                                                   char separator)
        This method tokenizes the given string, using the separator character as the tokenizing delimiter. This function extends the basic btokenize functionality by adding the ability to embed the separator in a string using an escape sequence. For example, if the delimiter is a ',' and the string actually had ',' s that shouldn't be interpreted as delimiters, these could be replaced with the '\,' escape sequence, causing them to be ignored by this function. The escape sequence is collapsed to a single character in the results.
      • convertDoubleSlash

        public static java.lang.String convertDoubleSlash(java.lang.String str)
      • convertSingleSlash

        public static java.lang.String convertSingleSlash(java.lang.String str)
      • format

        public static java.lang.String format(java.lang.String pattern,
                                              java.lang.Object[] arguments)

        This routine jackets java.text.MessageFormat.format() and hides the fact that that routine destroys apostrophes, and turns double and triple apostrophes into single apostrophes.

        Parameters:
        pattern - String to be passed to MessageFormat.format
        arguments - Object[] of parameters for substitution by MessageFormat.format
        Returns:
        String formatted string with substitutions made
      • getWordList

        public static java.lang.String[] getWordList(java.lang.String str)
      • replaceText

        public static java.lang.String replaceText(java.lang.String content,
                                                   java.lang.String pattern,
                                                   java.lang.String replace)
        Replaces all occurrances of the pattern in the content string with the given replace text. The comparison is case-sensitive.
        Parameters:
        String - content
        String - pattern
        String - replace
      • testCharacters

        public static java.lang.String testCharacters(java.lang.String str,
                                                      java.lang.String chars)
      • wordWrapString

        public static java.lang.String[] wordWrapString(java.lang.String str,
                                                        java.awt.FontMetrics metrics,
                                                        int maxWidth)
        Breaks up a long string into multiple Strings between words to fit in a graphical area of a specified font & width.