摘要: 通过对String类和StringBuffer类的学习和理解,来进行字符串应用的简单实现,因为我是初学者所以我的学习就是简单的实现。1.截取字符串输入为一个字符串和字节数,输出为按照字节数截取的字符串,要保证汉字不会被截半个。例如“我ABC们DEF,6”,要输出“我ABC”,而不会出现汉字截取错误。其实这个题是我看到网上做的,而且我也觉得他的方法很好,所以拿出来和大家共同分享public class copyFor { public static void main(String[] args) throws UnsupportedEncodingException{ St... 阅读全文
posted @ 2012-09-14 21:07 qqhegg 阅读(377) 评论(2) 推荐(0) 编辑
摘要: 在lang包中,常用的类也是大家非常熟悉的一个就是String类了,说到String就不能不想到StringBuffer1.String和StringBuffer的区别String类描述了固定长度的字符串,内容不变,适用于字符串常量;StringBuffer描述的是长度可变且内容可变的字符串,适用于对字符串中的字符进行各种操作的字符串常量。2.String类的方法String类可以说是一个宝藏,每一个方法都是那么重要,是我们编程过程经常会遇到会使用的一个类,看看String类提供的方法Method Summary charcharAt(int index) Returns the char . 阅读全文
posted @ 2012-09-14 19:52 qqhegg 阅读(383) 评论(0) 推荐(0) 编辑
摘要: 在API中看一下对这个包描述Package java.lang DescriptionProvides classes that are fundamental to the design of the Java programming language. The most important classes are Object, which is the root of the class hierarchy, and Class, instances of which represent classes at run time.Frequently it is necessary to 阅读全文
posted @ 2012-09-14 19:25 qqhegg 阅读(363) 评论(0) 推荐(0) 编辑