Here you can find the source of getValueType(String inputValue)
public static int getValueType(String inputValue)
//package com.java2s; /*// w w w . j a v a 2 s .c o m * This class provides string manipulation methods. * * $Author: davis $ * $Date: 2004/12/18 21:23:31 $ * $Revision: 1.1 $ * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Revision History: * * Written by Davis Swan in February, 2004. */ import java.sql.Types; public class Main { public static int getValueType(String inputValue) { double doubleValue; long intValue; if (inputValue.startsWith("\"") | inputValue.startsWith("'")) return Types.CHAR; try { /* * If the parse methods don't generate an exception this is a * valid number */ if (inputValue.trim().indexOf(".") > -1) { doubleValue = Double.parseDouble(inputValue.trim()); return Types.FLOAT; } else { intValue = Long.parseLong(inputValue.trim()); return Types.INTEGER; } } catch (Exception e) { return Types.CHAR; } } }