1:将字符串转化为数组
比如:"1,2,3,4,5"变成一个数组a,a={"1","2","3","4","5"}
方法:
String sr = "1,2,3,4,5";
String[] a = sr.split(",");
2:.net和JAVA字符串转换为字节数组
1 .NET
byte[] bytestr = System.Text.Encoding.UTF8.GetBytes("中国");
Label1.Text = bytestr.Length.ToString();
具体的内容封装在mscorlib.dll中,不知道GetBytes()怎么实现的?有谁知道请告诉我一下。
2 JAVA
String str = "马";
try
{
strByte = str.getBytes("UTF-8");
System.out.println(strByte.length);
}
catch(Exception e)
{
e.getStackTrace();
}
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/longronglin/archive/2007/04/09/1557824.aspx