📄 teststring.java.bak
字号:
import java.io.*;
public class TestString
{
public static void main(String args[])
{
String temp = "hi, :$:happy:$: i am tom:$:sad:$:adafaf.";
System.out.println(temp);
//for (int i = 0; i < temp.length() ; i++)
//{
System.out.println( temp.indexOf(":$:", 0));
//}
int i = 1;
int firstIndex = -1;
while (temp.indexOf(":$:", i) != -1)
{
System.out.println("Loop");
firstIndex = temp.indexOf(":$:", i);
i = firstIndex + 3; //becuase the string is ":$"
if (temp.indexOf(":$:", i) != -1)
{
System.out.println(temp.substring(0, firstIndex ));
System.out.println(temp.substring(i, temp.indexOf(":$:", i)));
temp = temp.substring(temp.indexOf(":$:", i) + 3);
System.out.println(temp);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -