Java replace() 方法
Java 教程
· 2019-02-08 23:42:31
replace() 方法通过用 newChar 字符替换字符串中出现的所有 oldChar 字符,并返回替换后的新字符串。
语法
public String replace(char oldChar,
char newChar)
参数
oldChar -- 原字符。
newChar -- 新字符。
返回值
替换后生成的新字符串。
实例
public class Test {
public static void main(String args[]) {
String Str = new String("hello");
System.out.print("返回值 :" );
System.out.println(Str.replace('o', 'T'));
System.out.print("返回值 :" );
System.out.println(Str.replace('l', 'D'));
}
}
以上程序执行结果为:
返回值 :hellT 返回值 :heDDo
点击查看所有 Java 教程 文章: https://www.codercto.com/courses/l/12.html
莱昂氏UNIX源代码分析
(澳)John Lions / 尤晋元 / 机械工业出版社 / 2000-7-1 / 49.00
本书由上、下两篇组成。上篇为UNIX版本6的源代码,下篇是莱昂先生对UNIX操作系统版本6源代码的详细分析。本书语言简洁、透彻,曾作为未公开出版物广泛流传了二十多年,是一部杰出经典之作。本书适合UNIX操作系统编程人员、大专院校师生学习参考使用。一起来看看 《莱昂氏UNIX源代码分析》 这本书的介绍吧!