String,int,char,byte[]数组的相互转换
来源:互联网 发布:天下游虚拟定位软件 编辑:程序博客网 时间:2024/05/16 08:46
1. String 转换为int
String str = "abc";
int data = Integer.parseInt(str);
或者
int data = Integer.valueOf(str);
2.int 型数据转换到String
int a = "3";
String str = Integer.valueOf(a).toString();
3.String 型数据转换为char型
String str = "abc";
char[] a = str.toCharArray();
4.char型转化为String型
char a ;
String str = Character.valueOf(a).toString();
5.String 型数据转换为byte[]数组
byte[] buf = new byte[1024];
String str = "abcd";
buf = str.getBytes()或者buf = str.getBytes("utf-8");
6.byte[]数组转换为String 型数据
byte[] buf = new byte[1024];
String str = new String(buf);
str= String.copyValueOf(str.toCharArray(), 0, buf.length]);
0 0
- String,int,char,byte[]数组的相互转换
- string,char,int类型的相互转换
- int、char、double与byte相互转换的程序
- int、char、double与byte相互转换的程序
- int、char、double与byte相互转换的程序
- int、char、double与byte相互转换的程序
- int、char、double与byte相互转换的程序
- int、char、double与byte相互转换的程序
- int、char、double与byte相互转换的程序
- int、char、double与byte相互转换
- int、char、与byte相互转换
- int、char、double与byte相互转换
- int、char、double与byte相互转换
- c++ CString string char* char int类型的相互转换
- 整型int和字符数组byte相互转换的源程序
- java int与byte[]数组的相互转换 补码
- java中的int类型和byte数组的相互转换
- 整型变量(int)与字节数组(byte[])的相互转换
- Search Insert Position
- Maven项目部署使用问题及注意点
- UVA - 11218 KTV(暴力求解)
- eclipse 中的输入提示设置
- 我编程基础很差,但是我有经验,相信努力会成功
- String,int,char,byte[]数组的相互转换
- centos安装 MySQL Workbench 过程中出现 Requires libtinyxml.so.0()解决办法
- Linux用wget下载Sun JDK
- jeecms框架使用笔记
- 素数
- Add Two Numbers
- 工作相关
- RSA非对称加密
- 第一次JAVA作业