Documentation of 'org.joone.util.CSVParser' Java class
CSVParser
org.joone.util

Class CSVParser



  • public class CSVParser
    extends java.lang.Object
    Comma Separated Values Parser This helper class parses a string containing comma separated tokens. Each token can contain a single value or a range represented by two values separated by a separator.
    • Constructor Summary

      Constructors 
      Constructor and Description
      CSVParser(java.lang.String values)
      Creates a new instance of CSVParser
      CSVParser(java.lang.String values, boolean range)
      Creates a new instance of CSVParser
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      static void main(java.lang.String[] args)
      Test
      double[] parseDouble()
      Parse the string and returns an array containing all the values encountered.
      int[] parseInt()
      Parse the string and returns an array containing all the values encountered.
      • Methods inherited from class java.lang.Object

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

      • CSVParser

        public CSVParser(java.lang.String values)
        Creates a new instance of CSVParser
        Parameters:
        values - The string containing the values to parse
      • CSVParser

        public CSVParser(java.lang.String values,
                         boolean range)
        Creates a new instance of CSVParser
        Parameters:
        values - The string containing the values to parse
        range - true (default) if ranges allowed
    • Method Detail

      • parseInt

        public int[] parseInt()
                       throws java.lang.NumberFormatException
        Parse the string and returns an array containing all the values encountered. Let we have a string containing: '1,3-5,8,10-12' The method parseInt() will return an array containing: [1,3,4,5,8,10,11,12] WARNING: A RANGE CANNOT CONTAIN NEGATIVE NUMBERS
        Returns:
        an array of integer containing all the values parsed
        Throws:
        java.lang.NumberFormatException
      • parseDouble

        public double[] parseDouble()
                             throws java.lang.NumberFormatException
        Parse the string and returns an array containing all the values encountered. Let we have a string containing: '1.0,-1.0,0.0' The method parseDouble() will return an array containing: [1.0,-1.0,0.0] WARNING: RANGE NOT ALLOWED, AS IT MAKES NO SENSE IN THIS CASE
        Returns:
        an array of double containing all the values parsed
        Throws:
        java.lang.NumberFormatException
      • main

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

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.