Class StringProcessor

java.lang.Object
overit.geocall.util.StringProcessor
All Implemented Interfaces:
Iterator

public class StringProcessor extends Object implements Iterator
Utility class used to create a PoweredString that implements Iterator
  • Constructor Details

    • StringProcessor

      public StringProcessor(String s)
      Creates new PoweredString
      Parameters:
      s - String representing the StringProcessor
    • StringProcessor

      public StringProcessor(String s, boolean bIgnoreCase)
      Creates new PoweredString
      Parameters:
      s - String representing the StringProcessor
      bIgnoreCase - Boolean value that indicates if ignore case is active
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • replace

      public String replace(char c1, char c2)
      Replace the first parameter with the second one
      Parameters:
      c1 - The char to be replaced
      c2 - The replacing char
      Returns:
      The string with the replaced char
    • replace

      public String replace(String s1, String s2)
      Replace the first parameter with the second one
      Parameters:
      s1 - The string to be replaced
      s2 - The replacing string
      Returns:
      The string wiht the replaced string
    • indexOf

      public int indexOf(String s, int i)
      Returns the index within this string of the first occurrence of the specified substring, starting at the specified index. The returned index is the smallest value k for which: k >= fromIndex && this.startsWith(str, k) If no such value of k exists, then -1 is returned.
      Parameters:
      s - The substring to search for
      i - The index from wich to start the search
      Returns:
      The index of the first occurrence of the specified string, starting at the specified index, -1 if there is no such occurrence
    • indexOf

      public int indexOf(String s)
      Returns the index within this string of the first occurrence of the specified substring. The returned index is the smallest value k for which: k <= fromIndex && this.startsWith(str, k) If no such value of k exists, then -1 is returned.
      Parameters:
      s - The substring to search for
      Returns:
      The index of the first occurrence of the specified string, -1 if there is no such occurrence
    • tokenize

      public String[] tokenize(String d)
      The string tokenize allows an application to break a string into tokens.
      Parameters:
      d - The delimiter string (the string that separate tokens)
      Returns:
      An array of tokenized string
    • tokenize

      public String[] tokenize(String d, int max)
      The string tokenize allows an application to break a string into tokens.
      Parameters:
      d - The delimiter string (the string that separate tokens)
      max - Maximun number of time it should be tokenized, '0' to tokenize till the end
      Returns:
      An array of tokenized string
    • iterator

      public Iterator iterator()
      Returns the iterator
      Returns:
      The iterator
    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator
    • next

      public Object next()
      Specified by:
      next in interface Iterator
    • remove

      public void remove()
      Specified by:
      remove in interface Iterator