File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

String/Character Problem

 
Anthony Smith
Ranch Hand
Posts: 285
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have some code on a JSP page but it is purely a java problem that I am having...
Here is the code...
String URL = request.getParameter("URL");
String newURL = request.getParameter("URL") + "?";
String addOn = request.getParameter("instructions");
for (int i = 0; i!=addOn.length(); i++)
{
if (addOn.charAt(i)==(' '))
out.print("DDDDDDDDDDD");//newURL = newURL + "&";
else
newURL = newURL + addOn.charAt(i);
out.print(addOn.charAt(i) + "<br>");
}
out.println("<br>" + request.getParameter("instructions"));
********************************
addOn.charAt(i)==(' '))
This method does not recognize my blanks.... Is there a better way?
 
Deepa Balasubramanayam
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not good at strings but still try this
String someVariable=" ";
for (int i = 0; i!=addOn.length(); i++)
{
someVariable = addOn.charAt(i);
if (someVariable.equals(""))
out.print("DDDDDDDDDDD");//newURL = newURL + "&";
else
newURL = newURL + someVariable;
out.print(someVariable + "<br>");
}
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using the char assignment. Space is a 32
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic