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 July 3rd, 2004, 07:06 AM
naitsabe$ naitsabe$ is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 6 naitsabe$ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Smile a java beginner needs some help

Hello, i got a question for you java programers about if it's possible to change some text eg. katt = "help me"; to end up like: "help-me";

Is there any known way to change the " " to "-" automaticly?
thanks,
nait

Reply With Quote
  #2  
Old July 3rd, 2004, 02:09 PM
kode_monkey kode_monkey is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 367 kode_monkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 21 sec
Reputation Power: 16
In answer to the specific question the following code should help you out.

Code:
String blah = new String ("help me");
blah = blah.replace (' ', '-');


To clear up an obvious problem related to this please note that -

Code:
String blah = new String ("help me");
blah.replace (' ', '-');


does not work since strings are immutable, ie cannot be changed. So you can set a string equal to the return value of a function but cannot directly change a string via one of its methods. If you don't get this give it a try and see what happens.

And for more general help, queries like this are best directed to the java api

http://java.sun.com/j2se/1.4.2/docs/api/

which will answer so many questions for you and to get anywhere with java you will have to get used to trawling through this lovely document .

Hope this helps,

-KM-

Reply With Quote
  #3  
Old July 3rd, 2004, 02:55 PM
naitsabe$ naitsabe$ is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 6 naitsabe$ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs up

Thanks alot mate!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > a java beginner needs some help


Developer Shed Advertisers and Affiliates


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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap