Bookmark Topic Watch Topic
  • New Topic

String search!

 
Sridhar Srinivasan
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi!
I need to get the values of the all the names in the following string.
str1="<P>fasfa     <INPUT id=1 maxLength=22 size=22 value=dfsd name=fdss oth="d"></P>
<P>rdrgfdg  <INPUT id=1 maxLength=33 size=33 value=fgdf name=fdgd oth="d"></P>
<P>dfgdfg <INPUT id=1 maxLength=33 size=33 value=dgdf name=dgf oth="d"></P>
<P>fdgdfgd     <INPUT id=1 maxLength=33 size=33 value=dfgd name=dsgdf oth="d"></P>"
All the four text boxes are in the same format and I am using the following code to get the values of "name".But I am getting 3 values and 1 value is missing.Can anybody help me to solve this?My code is as follows:
while(str1.indexOf("name=",index) !=-1)
{
index = str1.indexOf("name=",index);

str1 = str1.substring(index);
String nm = str1.substring(5,str1.indexOf(" "));%><%=index%><br><%
%><%="Name="+nm%>-<%
}
%>
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
I don't really see how this is substantially different than the question you asked here. Even that question seems to have more to do with String matching and manipulation than JSP, so I'll be moving it.
bear
 
    Bookmark Topic Watch Topic
  • New Topic