【发布时间】:2013-02-12 06:31:58
【问题描述】:
请在此方法方面需要帮助:
String d = ret.getData(); //I get the string using this
int ui;
ui = d.indexOf("=", d.indexOf("=")+1);
do{
int f=d.indexOf("=", ui+1 );
System.out.println(d.substring(ui+1, f-1));//Here I'm showing the results of my code
ui = ui + d.indexOf("=", ui);}
while ((d.indexOf("=") + ui)!= 0);
我的字符串是这个:
!re
=.id=*1
=name=ether1
=mtu=1500
=l2mtu=1600
=mac-address=D4:CA:6D:37:44:26
=arp=enabled
=auto-negotiation=true
=full-duplex=true
=speed=100Mbps
=running=true
=slave=false
=disabled=false
我的代码的结果是:
*1
ether1
l2mt
24:22
nin
而我想要得到的是:
*1
ether1
1500
1600
D4:CA:6D:37:44:26
enabled
true
true
100Mbps
true
false
false
我需要获取 "="
之后的所有内容请帮忙!谢谢
【问题讨论】:
-
您可以将
lastIndexOf()方法与substring()一起使用