Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 13th, 2007, 02:29 PM
noil123 noil123 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2007
Posts: 3 noil123 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 50 m 53 sec
Reputation Power: 0
Reversing a string with for loop

Hi, first time poster here.

I'm a total beginner at programming and I want to make a method that reverses the order of characters using a for loop. I was able to do the reversing like this:

Code:
StringBuffer mjonoBuff = new StringBuffer(mjono);
painvastainen = mjonoBuff.reverse().toString();
System.out.println(painvastainen);


But I need do it as a method and using a for loop. I guess I should somehow determine the lenght of the string and then start from the last character and place it as the first character in the reversed string. How can I do this?

Reply With Quote
  #2  
Old October 14th, 2007, 08:30 AM
noil123 noil123 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2007
Posts: 3 noil123 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 50 m 53 sec
Reputation Power: 0
anyone?

Reply With Quote
  #3  
Old October 14th, 2007, 09:29 AM
noil123 noil123 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2007
Posts: 3 noil123 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 50 m 53 sec
Reputation Power: 0
got it

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > Reversing a string with for loop


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT