07-String类型转换为整型(字符串处理)
来源:互联网 发布:幽默高质量的笑话 知乎 编辑:程序博客网 时间:2024/05/01 23:00
StringUtil.java
package com.lh.bean;public class StringUtil {// 第一种方法转换后的Int值private int intValue1;// 第一种方法转换后的Int值private int intValue2;// 被转换的字符串private String strValue;// 默认构造方法public StringUtil() {}// 使用Integer类的parseInt()方法进行转换public int getIntValue1() {return Integer.parseInt(strValue);}// 使用Integer类的valueOf()方法进行转换public int getIntValue2() {return Integer.valueOf(strValue);}public String getStrValue() {return strValue;}public void setStrValue(String strValue) {this.strValue = strValue;}}
index.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%><html><head><title>index.jsp</title></head><body><%String strAge = "26";%><!-- 使用userBean动作导入StringUtil类 --><jsp:useBean id="strBean" class="com.lh.bean.StringUtil"></jsp:useBean><!-- 对StringUtil类对象中的strValue属性赋值 --><jsp:setProperty property="strValue" name="strBean"value="<%=strAge %>" /><table><tr bgcolor="skyblue"><td align="center">使用Integer.parseInt()方法转换字符串:</td></tr><tr><td align="center"><!-- 获得StringUtil类对象中的IntValue1属性值 --> 年龄1:<jsp:getPropertyproperty="intValue1" name="strBean" />岁</td></tr><tr bgcolor="skyblue"><td align="center">使用Integer.valueOf()方法转换字符串:</td></tr><tr><td align="center"><!-- 获得StringUtil类对象中的IntValue2属性值 --> 年龄2:<jsp:getPropertyproperty="intValue2" name="strBean" />岁</td></tr></table></body></html>
- 07-String类型转换为整型(字符串处理)
- 将整型数据转换为string类型
- 06-将整型值转换为字符串(字符串处理)
- javascript 将字符串类型转换为整型
- QT 整型数据转换为字符串类型
- double类型转换为字符串, 整型转换为字符串
- 整型转换为字符串
- 字符串转换为整型
- 字符串转换为整型
- 字符串转换为整型
- 字符串转换为整型
- 字符串转换为整型
- 类型转换之字符串转换为长整型
- 高效的将整型类型转换为字符串的方法
- leetcode——String to Integer (atoi) 字符串转换为整型数(AC)
- 在vc中如何进行类型转换,比如把整型转换为字符串型或从字符串转换为整型
- 整型数组转换为字符串
- 把字符串转换为整型
- cygwin安装
- 《Pragmatic Thinking and Learning: Refactor your Wetware》
- Linux下如何编译并运行C程序
- 开源框架完美组合之Spring.NET + NHibernate + ASP.NET MVC + jQuery + easyUI 中英文双语言小型企业网站Demo
- DIV固定在页面某个位置,不随鼠标滚动而滚动
- 07-String类型转换为整型(字符串处理)
- dedecms后台模块管理空白的解决办法
- java调用mysql存储过程返回多个结果集,与.net不同
- gcc的原子操作
- 正则表达式
- break和continue的区别
- asp版 ckeditor 上传变成日期时间格式的方法
- 浅谈 STM32 硬件I2C的使用 (中断方式 无DMA 无最高优先级)
- TortoiseGit + GitHub 使用指南