org.apache.commons.lang.NumberUtils.stringToInt()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中org.apache.commons.lang.NumberUtils.stringToInt()方法的一些代码示例,展示了NumberUtils.stringToInt()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NumberUtils.stringToInt()方法的具体详情如下:
包路径:org.apache.commons.lang.NumberUtils
类名称:NumberUtils
方法名:stringToInt

NumberUtils.stringToInt介绍

[英]Convert a String to an int, returning zero if the conversion fails.
[中]将String转换为int,如果转换失败,则返回zero

代码示例

代码示例来源:origin: commons-lang/commons-lang

/**
 * <p>Convert a <code>String</code> to an <code>int</code>, returning
 * <code>zero</code> if the conversion fails.</p>
 * 
 * @param str  the string to convert
 * @return the int represented by the string, or <code>zero</code> if
 *  conversion fails
 */
public static int stringToInt(String str) {
  return stringToInt(str, 0);
}

代码示例来源:origin: org.apache.directory.api/api-ldap-client-all

/**
 * <p>Convert a <code>String</code> to an <code>int</code>, returning
 * <code>zero</code> if the conversion fails.</p>
 * 
 * @param str  the string to convert
 * @return the int represented by the string, or <code>zero</code> if
 *  conversion fails
 */
public static int stringToInt(String str) {
  return stringToInt(str, 0);
}

代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand

/**
 * <p>Convert a <code>String</code> to an <code>int</code>, returning
 * <code>zero</code> if the conversion fails.</p>
 * 
 * @param str  the string to convert
 * @return the int represented by the string, or <code>zero</code> if
 *  conversion fails
 */
public static int stringToInt(String str) {
  return stringToInt(str, 0);
}

代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.lang

/**
 * <p>Convert a <code>String</code> to an <code>int</code>, returning
 * <code>zero</code> if the conversion fails.</p>
 * 
 * @param str  the string to convert
 * @return the int represented by the string, or <code>zero</code> if
 *  conversion fails
 */
public static int stringToInt(String str) {
  return stringToInt(str, 0);
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.commons.lang

/**
 * <p>Convert a <code>String</code> to an <code>int</code>, returning
 * <code>zero</code> if the conversion fails.</p>
 * 
 * @param str  the string to convert
 * @return the int represented by the string, or <code>zero</code> if
 *  conversion fails
 */
public static int stringToInt(String str) {
  return stringToInt(str, 0);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

/**
 * <p>Convert a <code>String</code> to an <code>int</code>, returning
 * <code>zero</code> if the conversion fails.</p>
 * 
 * @param str  the string to convert
 * @return the int represented by the string, or <code>zero</code> if
 *  conversion fails
 */
public static int stringToInt(String str) {
  return stringToInt(str, 0);
}

代码示例来源:origin: genjava/gj-core

static public String wordWrap(String str, String width, String delim, String split) {
  return wordWrap(str, NumberUtils.stringToInt(width), delim, split);
}
/**

代码示例来源:origin: genjava/gj-core

public void setWidths(String widths) {
  String[] nums = StringUtils.split(widths, ",");
  int sz = nums.length;
  this.widths = new int[sz];
  for(int i=0; i<sz; i++) {
    if("*".equals(nums[i])) {
      this.widths[i] = 0;
    } else {
      this.widths[i] = NumberUtils.stringToInt(nums[i]);
    }
  }
  calcSizeCondition();
}

相关文章