Topic: 请高手帮我定一段程序~谢谢~(lastindexof)

  Print this page

1.请高手帮我定一段程序~谢谢~(lastindexof) Copy to clipboard
Posted by: naughty009
Posted on: 2005-05-21 09:46

...........
end = str.lastindexof("+") //从后面搜索+号.
如果搜索到有就.......
否则就.....
if ( 这里怎样写?)
.................
else
......... .....

2.Re:请高手帮我定一段程序~~~~~谢谢~~~ [Re: naughty009] Copy to clipboard
Posted by: 催泪瓦斯
Posted on: 2005-05-21 09:53

if (end >=0)
...

3.Re:请高手帮我定一段程序~~~~~谢谢~~~ [Re: naughty009] Copy to clipboard
Posted by: why
Posted on: 2005-05-21 10:23

http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#lastIndexOf(java.lang.String)

public int lastIndexOf(String str)
Returns the index within this string of the rightmost occurrence of the specified substring. The rightmost empty string "" is considered to occur at the index value this.length(). The returned index is the largest value k such that
this.startsWith(str, k)
is true.

Parameters:
str - the substring to search for.

Returns:
if the string argument occurs one or more times as a substring within this object, then the index of the first character of the last such substring is returned. If it does not occur as a substring, -1 is returned.

4.Re:请高手帮我定一段程序~谢谢~(lastindexof) [Re: naughty009] Copy to clipboard
Posted by: 8166680
Posted on: 2005-05-23 01:51

if(end!=-1)
{
}
else
{
}


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923