Class JTStringParser

java.lang.Object
  extended byJTStringParser

public class JTStringParser
extends java.lang.Object

JTStringParser - Split a comma-delimited string into fields. The fields are accessible individually or as an array of Strings.

 SerialPort - serial connections for Java
 Copyright (C) 2005  Martin C Gregorie
 
 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 

Contact Martin Gregorie at martin@gregorie.org.
Read the GNU General Public License.


Constructor Summary
JTStringParser(java.lang.String vals)
          Construct a parser for the vals String.
 
Method Summary
 java.lang.String[] getArray()
          Get an array containing the parsed string.
 java.lang.String getField(int n)
          Get the nth field.
 int getFieldCount()
          Return the number of fields in the string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JTStringParser

public JTStringParser(java.lang.String vals)
Construct a parser for the vals String.

Method Detail

getArray

public java.lang.String[] getArray()
Get an array containing the parsed string.


getField

public java.lang.String getField(int n)
Get the nth field. Fields are enumerated from zero. If n < 0 or n >= getFieldCount() an empty string is returned.


getFieldCount

public int getFieldCount()
Return the number of fields in the string.