Here you can find the source of toInt(String param)
int
Parameter | Description |
---|
int
converted param
public static int toInt(String param)
//package com.java2s; /* Copyright (c) Inmobia Mobile Technology, Inc. All Rights Reserved. * /* ww w. j av a2 s .c om*/ * This software is the confidential and proprietary information of Inmobia * Mobile Technology. ("Confidential Information"). 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 Inmobia Mobile Technology. * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ public class Main { /** * * * Converts param to an <code>int</code> * <p> * * @param<code>String</code>param to convert to an <code>int</code> * @return<code>int</code>converted param */ public static int toInt(String param) { int result = 0; if (isParamSet(param)) result = Integer.valueOf(param); return result; } /** * Checks if param is set * * @param <code>String</code>param, parameter to check if it has been set * @return<code>boolean</code> true if param is set and false otherwise */ public static boolean isParamSet(String param) { boolean isSet = false; if (param != null && param.trim().length() > 0) isSet = true; return isSet; } }