Java Text Parse textToInteger(String filename, String text, String name)

Here you can find the source of textToInteger(String filename, String text, String name)

Description

text To Integer

License

Open Source License

Declaration

private static Integer textToInteger(String filename, String text, String name) throws Exception 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2006-2010 eBay Inc. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *******************************************************************************/

public class Main {
    private static Integer textToInteger(String filename, String text, String name) throws Exception {
        if (text == null || text.length() == 0) {
            throw new Exception("Bad integer. Filename= " + filename + ", name= " + name);
        }/*from w w w  . j  a  v a 2  s .  c  o m*/
        Integer intValue = null;
        try {
            intValue = Integer.valueOf(text);
        } catch (NumberFormatException e) {
            throw new Exception("Bad integer. Filename= " + filename + ", exception= " + e.toString());
        }
        return intValue;
    }
}

Related

  1. textToByte(char[] text)
  2. textToBytes(String text)
  3. textToCDATA(String text)
  4. textToInteger(String text)
  5. textToMMDDYYYY(String pdata)
  6. textToNumericFormat(String src)
  7. textToNumericFormatV4(String host)