/**
*定义一个字符串“hello world”将所有的“l”替换成“s”。
*@author 马涛
* April 14th,2009
*/
public class Replace
{
public static void main(String[] args)
{
String str = "hello world";
// 用String 的replace();
System.out.println(str.replace('l','s'));
}
}
定义一个字符串“hello world”将所有的“l”替换成“s”
最新推荐文章于 2023-02-01 16:58:07 发布
本文介绍了一个简单的Java程序,演示了如何使用String类的replace()方法将字符串“helloworld”中的所有字母'l'替换为's'。
413

被折叠的 条评论
为什么被折叠?



