Documentation of 'tig.Strings' Java class
Strings
tig

Class Strings

  • All Implemented Interfaces:
    GeneralConstants


    public abstract class Strings
    extends java.lang.Object
    implements GeneralConstants
    Class containing utility static methods for String manipulation.
    • Constructor Summary

      Constructors 
      Constructor and Description
      Strings() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.lang.String doubleArrayToString(double[] doubleArray)
      Converts a double[] to a String.
      static int findIndex(java.lang.String[] array, java.lang.String s)
      Finds the position of a String in an array (a String[]).
      static java.lang.String intArrayToString(int[] intArray)
      Converts a int[] to a String.
      static double parseDouble(java.lang.String s)
      Equivalent to java.lang.Double.parseDouble(String), but more permissive.
      static java.lang.String replace(java.lang.String theString, java.lang.String s1, java.lang.String s2)
      All occurences of 's1' contained in 'theString' are replaced by s2.
      static double[] stringToDoubleArray(java.lang.String str)
      Converts a String to an double[] ; in the String, the doubles must be separated by comas (',').
      static int[] stringToIntArray(java.lang.String str)
      Converts a String to an int[] ; in the String, the integers must be separated by comas (',').
      static java.lang.String[] stringToStringArray(java.lang.String s)
      Convenient method to call stringToStringArray(String, char), using a coma (',') as separator.
      static java.lang.String[] stringToStringArray(java.lang.String s, char separator)
      Transforms a String in an array of Strings.
      • Methods inherited from class java.lang.Object

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

      • Strings

        public Strings()
    • Method Detail

      • findIndex

        public static int findIndex(java.lang.String[] array,
                                    java.lang.String s)
        Finds the position of a String in an array (a String[]).
        Parameters:
        array - Arry of Strings where String 's' is searched.
        s - String we want to locate in array
        Returns:
        The position of s in array, or GeneralConstants.NO_SPECIF if not found.
      • stringToStringArray

        public static java.lang.String[] stringToStringArray(java.lang.String s)
        Convenient method to call stringToStringArray(String, char), using a coma (',') as separator.
      • stringToStringArray

        public static java.lang.String[] stringToStringArray(java.lang.String s,
                                                             char separator)
        Transforms a String in an array of Strings.
        Example : if s = "arg1, arg2,arg3 " and separator = ',', stringToStringArray returns :
        arg1 arg2 arg3
        Points to consider :
      • Leading and trailing spaces are removed (see arg2 and arg3).
      • Separators at the begining or at the end of s lead to creation of empty Strings in the resulting array.
      • The same thing happens if two separators are side by side :
        if s=",arg1,, arg2,arg3", stringToStringArray returns :
        (empty String) arg1 (empty String) arg2 arg3
Parameters:
s - String to analyze.
separator - Character used as separator to analyze s.
Returns:
An array of Strings resulting from the analysis.
Skip navigation links

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.