User Name Password Register
DaniWeb IT Discussion Community
All
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 375,171 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,129 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: 828 | Replies: 1
Reply
Join Date: Dec 2006
Location: in a dream
Posts: 124
Reputation: nschessnerd is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 5
nschessnerd's Avatar
nschessnerd nschessnerd is offline Offline
Junior Poster

Help java to javascript

  #1  
Jan 4th, 2007
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:

 
        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
        
    }
 
Thanks!
M
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2006
Location: India
Posts: 1,288
Reputation: vishesh is on a distinguished road 
Rep Power: 4
Solved Threads: 32
vishesh's Avatar
vishesh vishesh is offline Offline
Nearly a Posting Virtuoso

Re: java to javascript

  #2  
Jan 6th, 2007
First of all Java and JavaScript is totally different thing. Java is OOp programming language and JavaScript is browser scripting language.

But, still I think you mean something else, tell your problem clearly.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 12:00 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC