Class StringUtils


  • public class StringUtils
    extends java.lang.Object
    Code here was swiped from plexus-utils' StringUtils class, so plexus-interpolation could be completely self-contained.
    • Constructor Summary

      Constructors 
      Constructor Description
      StringUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String capitalizeFirstLetter​(java.lang.String data)  
      static java.lang.String replace​(java.lang.String text, java.lang.String repl, java.lang.String with)
      Replace all occurrences of a String within another String.
      static java.lang.String replace​(java.lang.String text, java.lang.String repl, java.lang.String with, int max)
      Replace a String with another String inside a larger String, for the first max values of the search String.
      • Methods inherited from class java.lang.Object

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

      • StringUtils

        public StringUtils()
    • Method Detail

      • replace

        public static java.lang.String replace​(java.lang.String text,
                                               java.lang.String repl,
                                               java.lang.String with)

        Replace all occurrences of a String within another String.

        A null reference passed to this method is a no-op.

        Parameters:
        text - text to search and replace in
        repl - String to search for
        with - String to replace with
        Returns:
        the text with any replacements processed
        See Also:
        replace(String text, String repl, String with, int max)
      • replace

        public static java.lang.String replace​(java.lang.String text,
                                               java.lang.String repl,
                                               java.lang.String with,
                                               int max)

        Replace a String with another String inside a larger String, for the first max values of the search String.

        A null reference passed to this method is a no-op.

        Parameters:
        text - text to search and replace in
        repl - String to search for
        with - String to replace with
        max - maximum number of values to replace, or -1 if no maximum
        Returns:
        the text with any replacements processed
      • capitalizeFirstLetter

        public static java.lang.String capitalizeFirstLetter​(java.lang.String data)