[hotjoe.com] HotJoe Java Help Forums
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Visit java.com
Please send email if you are having login problems - see the posts below for more info.
Hotmail and Yahoo! users - please see the Hotmail post or the Yahoo! post for information on lost emails.
How can I use Scanner ?  XML
Forum Index » Java Programming
Author Message
Sunb3

Newbie

Joined: 02/17/2010 08:34:31
Messages: 2
Offline

Hi Community,

I'm new user of java Programming, could you help me with the following problem?

I have the following parameter : name@surname and I have to take the "name" only.

Until now I'm using this syntax:

Scanner sc = Scanner ("name@surname").useDelimiter("@");

Now How can I get the name only in order to have, for example:

datasource.setParameter("vaiable","name") ?????

Do you know any idea?

Thank you very much

stdunbar

Newbie
[Avatar]

Joined: 06/22/2005 14:51:37
Messages: 751
Location: Superior, CO, USA
Offline

Personally I would use the String.split() method. You would read from the Scanner as a String and then split() the parts into a String array.

Thanks for using the forums at hotjoe.com
[WWW] [Yahoo!] [ICQ]
Sunb3

Newbie

Joined: 02/17/2010 08:34:31
Messages: 2
Offline

Dont' worry I used "name@surname".substring(0,4) to extract "name", thank you
 
Forum Index » Java Programming
Go to:   
Powered by JForum 2.1.8 © JForum Team
This site built by Scott Dunbar of Xigole Systems. © 2005-2010 - Scott Dunbar
Java and the Java Get Powered logo are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries.
hotjoe.com and xigole.com have no affiliation with Sun Microsystems, Inc.