Writing string methods
Posted on 2003-03-04
i have been tryin to write these methods but have been unable to do them at all please see if u can do these and email me thankx a lot
public static String grow(String small, double factor) – This method returns an array of Strings storing the identical Strings and in the same order as those contained in the array of Strings small, however, the length of the returned array of Strings is (factor * small.length). Factor must be >= 1.0.
public static boolean add(String set, String str) – This adds the String str to the array of Strings set if set contains no String equal to str. Returns true if the String str was added, false otherwise.
public static void selectionSort(String s) – This method sorts the Strings contained in the array of strings s lexicographically.
public static void print(String s) – This method prints the Strings contained in the array of Strings s to the display with a space between each String. A new line follows the last String.
public static void copy(String from, String to) – This method copies the Strings contained in the array of Strings from into the array of Strings to. If array to is smaller than array from only the first to.length Strings will be copied into the array to.