JavaSE8基础 String 将char数组的一部分转为String
2017-09-03 10:55
447 查看
礼悟:
公恒学思合行悟,尊师重道存感恩。叶见寻根三返一,江河湖海同一体。
虚怀若谷良心主,愿行无悔给最苦。读书锻炼养身心,诚劝且行且珍惜。
code:
result:
Java优秀,值得学习。
学习资源:API手册+Java源码+清净的心地。
公恒学思合行悟,尊师重道存感恩。叶见寻根三返一,江河湖海同一体。
虚怀若谷良心主,愿行无悔给最苦。读书锻炼养身心,诚劝且行且珍惜。
os :windows7 x64
jdk:jdk-8u131-windows-x64
ide:Eclipse Oxygen Release (4.7.0)
jdk:jdk-8u131-windows-x64
ide:Eclipse Oxygen Release (4.7.0)
code:
package jizuiku.t01; public class Demo1 { public static void main(String[] args) { char[] c = { 'a', 'b', 'c', 'd', 'e', 'f' }; int startIndex = 1;// 从c[1]开始 int count = 2;// 转2个,c[1]、c[2]拼在一起 String str = new String(c, startIndex, count); System.out.println(str); } }
result:
Java优秀,值得学习。
学习资源:API手册+Java源码+清净的心地。
相关文章推荐
- JavaSE8基础 String toCharArray 字符串转换成字符数组
- JavaSE8基础 String 通过构造方法把部分一维byte数组转为字符串
- JavaSE8基础 String 通过构造方法 将一维char数组化为String
- JavaSE8基础 String 通过构造方法 将整个一维byte数组化为String
- 【语言基础】c++ 基本数据类型与字节数组(string,char [] )之间的转化方法
- JavaSE8基础 String.format %c 输出char类型的变量
- JavaSE8基础 StringBuffer toString 将其转为String对象
- JavaSE8基础 Arrays.toString 将一维int数组转成字符串输出
- JavaSE8基础 char[] 根据变量的值生成指定长度的一维char数组
- JavaSE8基础 Integer.toString 将int类型转为同面值的String类型
- String 转为 字符数组char[]
- JavaSE8基础 String String.valueOf 将字符数组转成字符串
- 【转载】CString,string,char数组的转换
- C#---字符串string与字符数组char,字符串中大小写转换
- JavaSE8基础 String是特殊的引用类型,在函数的参数传递中只能把它当做 值类型来看待
- java中如何将char数组转化为String
- JAVA_char[]数组与String类型的互换
- 【转】wchar_t*,wchar_t,wchat_t数组,char,char*,char数组,std::string,std::wstring,CString....相互之间的转化
- string和char数组之间的转换
- wchar_t*,wchar_t,wchat_t数组,char,char*,char数组,std::string,std::wstring,CString转自由骑士大哥