All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.TKnudsen.ComplexDataObject.model.io.parsers.objects.IntegerParser Maven / Gradle / Ivy

Go to download

A library that models real-world objects in Java, referred to as ComplexDataObjects. Other features: IO and preprocessing of ComplexDataObjects.

There is a newer version: 0.2.13
Show newest version
package com.github.TKnudsen.ComplexDataObject.model.io.parsers.objects;

/**
 * 

* Title: IntegerParser *

* *

* Description: *

* *

* Copyright: Copyright (c) 2016 *

* * @author Juergen Bernard * @version 1.0 */ public class IntegerParser implements IObjectParser { @Override public Integer apply(Object object) { String stringValue = String.valueOf(object).toLowerCase(); stringValue = stringValue.trim(); stringValue = stringValue.replace(",", "."); if (stringValue.contains(" ")) stringValue = stringValue.substring(0, stringValue.indexOf(" ")); try { return Integer.parseInt(stringValue); } catch (Exception e) { return null; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy