[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: 849
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.9 © JForum Team
This site run by Scott Dunbar of Xigole Systems. © 2005-2011 - Scott Dunbar
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners
hotjoe.com, xigole.com, and Scott Dunbar have no affiliation with Oracle