•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 426,394 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,272 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 873 | Replies: 1
Hey peeps, im working on a method to format inputed text to include html, and i need to read line by line. is there any way i can do this? My java code looked like this:
Thanks!
M
public String convert(){
int b=0;
int e=0; //vars
String f = "";
String p = poem.getText();
if(poem.getLineCount()>1){
for(int i=0;i<poem.getLineCount()-1;i++){
try{
b=poem.getLineStartOffset(i); //gets start of line
e=poem.getLineEndOffset(i); //gets end of line
}catch(Exception E){
System.out.println(E);
}
f+=p.substring(b,e-1)+"<br />"+"\n"; //add line break to end of line
}
} else{
f+=p+"\n"; //does this if 1 line
}
return f; //returns poem with line breaks
}
M
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Javascript vs Java Applet (JavaScript / DHTML / AJAX)
- difference java javascript (Java)
- Page Cannot Be Displayed & javascript:doNetDetect() Errors (Viruses, Spyware and other Nasties)
- recommendations for JavaScript learning resources? (JavaScript / DHTML / AJAX)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Filling values of a dropdown
- Next Thread: Levyo Ajax Technology Gallery



Threaded Mode