Java Integer Create toInteger(String val)

Here you can find the source of toInteger(String val)

Description

to Integer

License

Apache License

Declaration

public static Integer toInteger(String val) 

Method Source Code

//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License");

public class Main {
    public static Integer toInteger(String val) {
        return isBlank(val) ? null : new Integer(val.trim());
    }//from  w  w  w.  j a va  2s  .  c  o  m

    public static boolean isBlank(String value) {
        return value == null || value.trim().length() == 0;
    }

    public static String trim(String str, String trim) {
        int start = 0;

        while (str.startsWith(trim, start))
            start += trim.length();

        str = str.substring(start);

        while (str.endsWith(trim))
            str = str.substring(0, str.length() - trim.length());

        return str;
    }
}

Related

  1. toInteger(String str)
  2. toInteger(String str)
  3. toInteger(String str)
  4. toInteger(String string)
  5. toInteger(String string, Integer deff)
  6. toInteger(String value)
  7. toInteger(String value)
  8. toInteger(String value)
  9. toInteger(String value)