「Java」Integer.valueOf(文字列).intValue()で文字列を数値に変換する
説明
1.public static Integer valueOf(String s)throws NumberFormatException
指定されたStringの値を保持するIntegerオブジェクトを返します。
2.public int intValue()
このIntegerの値をintとして返します。
使用例
package com.arkgame.study.cft;
public class InterValueSample {
      public static void main(String[] args) {
            int res = 0;
            String target = "5638";
            if ((target != null) && (target.length() > 0)) {
                  res = Integer.valueOf(target).intValue();
            }
            System.out.print("文字列->数値: " + res);
      }
}
結果
文字列->数値: 5638