stringprocessingdemo.java
来自「java编程代码」· Java 代码 · 共 23 行
JAVA
23 行
public class StringProcessingDemo
{
public static void main(String[] args)
{
String sentence = "I hate text processing!";
int position = sentence.indexOf("hate");
String ending =
sentence.substring(position + "hate".length( ));
System.out.println("01234567890123456789012");
System.out.println(sentence);
System.out.println("The word \"hate\" starts at index "
+ position);
sentence = sentence.substring(0, position) + "adore"
+ ending;
System.out.println("The changed string is:");
System.out.println(sentence);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?