Package lc.test

Class ToArray


  • public class ToArray
    extends java.lang.Object
    Convert the input string to an array.
    • Constructor Summary

      Constructors 
      Constructor Description
      ToArray()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int[] intArray​(java.lang.String input)
      Convert the input string to an integer (primitive) array.
      static java.lang.Integer[] integerArray​(java.lang.String input)
      Convert the input string to an integer (object) array.
      static void main​(java.lang.String[] args)  
      static java.lang.String[] stringArray​(java.lang.String input)  
      static char[][] twoDCharArray​(java.lang.String input)
      Convert the input string to a 2D character array.
      static int[][] twoDIntArray​(java.lang.String input)  
      • Methods inherited from class java.lang.Object

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

      • ToArray

        public ToArray()
    • Method Detail

      • stringArray

        public static java.lang.String[] stringArray​(java.lang.String input)
      • intArray

        public static int[] intArray​(java.lang.String input)
                              throws java.lang.NumberFormatException
        Convert the input string to an integer (primitive) array. Every string must be represented by a number, not "null" or other non-numerical strings.
        Parameters:
        input - the input string.
        Returns:
        an integer (primitive) array containing numbers from the input string.
        Throws:
        java.lang.NumberFormatException - for non-numerical strings.
      • twoDCharArray

        public static char[][] twoDCharArray​(java.lang.String input)
        Convert the input string to a 2D character array.
        Parameters:
        input - the input string.
        Returns:
        a 2D character array
      • twoDIntArray

        public static int[][] twoDIntArray​(java.lang.String input)
                                    throws java.lang.NumberFormatException
        Throws:
        java.lang.NumberFormatException
      • integerArray

        public static java.lang.Integer[] integerArray​(java.lang.String input)
        Convert the input string to an integer (object) array.
        Parameters:
        input - the input string.
        Returns:
        an integer (object) array containing numbers from the input string.
      • main

        public static void main​(java.lang.String[] args)