Java Number Parse toNumber(String string)

Here you can find the source of toNumber(String string)

Description

to Number

License

Open Source License

Declaration

public static String toNumber(String string) 

Method Source Code

//package com.java2s;
/**/*from w w  w.  ja v a 2s . c  o m*/
 * Copyright (c) 2015 SK holdings Co., Ltd. All rights reserved.
 * This software is the confidential and proprietary information of SK holdings.
 * You shall not disclose such confidential information and shall use it only in
 * accordance with the terms of the license agreement you entered into with SK holdings.
 * (http://www.eclipse.org/legal/epl-v10.html)
 */

public class Main {

    public static String toNumber(String string) {
        char[] stringArray = string.toCharArray();
        StringBuilder number = new StringBuilder();
        for (char ch : stringArray) {
            if (ch >= '0' && ch <= '9') {
                number.append(ch);
            }
        }

        return number.toString();
    }
}

Related

  1. toNumber(Object object, Number defaultValue)
  2. toNumber(Object object, Number defaultValue)
  3. toNumber(String hash)
  4. toNumber(String num)
  5. toNumber(String s)
  6. toNumber(String text)
  7. toNumber(String value, int defValue)
  8. toNumberArray(byte[] array)
  9. toNumberMatrix(byte[][] matrix)