更新时间:2021-10-13 22:40:02
可以使用下面给出的类String
It can be done using the method given below of class String
METHOD: (public String[] split(String regex, int limit)
public class TestSplit
{
public static void main(String args[])
{
String str = new String("I Love Java <=> I Love Python");
for (String retval: str.split("<=> ",2))
{
System.out.println(retval);
}
}
}
输出:
我爱Java
I Love Java
我喜欢Python
还有其他一些我知道的事实大约列在下面
There are some other facts I am aware about are listed below
public class TestSplit
{
public static void main(String args[])
{
String str = new String("I Love Java <=> I Love Python <=> I Love ***");
for (String retval: str.split("<=> "))
{
System.out.println(retval);
}
}
}
输出:
我喜欢Java
I Love Java
我喜欢Python
我喜欢***
I Love ***