Results 1 to 8 of 8
- 09-14-2010, 03:03 AM #1
Member
- Join Date
- Sep 2010
- Posts
- 36
- Rep Power
- 0
- 09-14-2010, 03:04 AM #2
Senior Member
- Join Date
- May 2010
- Posts
- 436
- Rep Power
- 4
Please define your problem in greater detail. What is your text? What have you tried? What problems are you currently having? About all I can say based on your somewhat general question is here's the tutorial: How to use the Scanner
- 09-14-2010, 04:47 AM #3
Do you want to read spaces or skip spaces?
- 09-14-2010, 09:03 AM #4
Member
- Join Date
- Sep 2010
- Posts
- 36
- Rep Power
- 0
I want to read spaces. I got it now. Thanks a lot for your help, Norm:)
- 09-14-2010, 02:16 PM #5
Can you post your solution so others will know how to do it?
- 09-14-2010, 02:49 PM #6
Member
- Join Date
- Sep 2010
- Posts
- 36
- Rep Power
- 0
Yes, sure. I will try to post my solution next time. THanks a lot for your advices :)
- 09-14-2010, 04:06 PM #7
Member
- Join Date
- Jul 2010
- Posts
- 1
- Rep Power
- 0
If you use next() --> Take the first word of String you enterd.Scanner input = new Scanner(System.in);
String str1 = input.next();
String str2 = input.nextLine();
Ex: Hello my friend --> str1 = "Hello"
It better if you use nextLine() --> str2 = "Hello my friend"Last edited by hanthuy; 09-14-2010 at 04:07 PM. Reason: better
- 09-16-2010, 05:44 PM #8
Member
- Join Date
- Sep 2010
- Posts
- 36
- Rep Power
- 0
Similar Threads
-
how to repalce space with %20 in a string
By Basit781 in forum CLDC and MIDPReplies: 4Last Post: 06-13-2012, 08:08 PM -
Can i use Java Scanner with String?
By guitar-maniac in forum New To JavaReplies: 5Last Post: 01-18-2010, 07:36 PM -
Java split string, the first char is a space
By new_cyber in forum New To JavaReplies: 8Last Post: 12-31-2009, 01:27 AM -
Lucene Not Throwing Matches When Search String Is Without Space
By nishu.soni in forum LuceneReplies: 0Last Post: 11-17-2009, 01:58 PM -
Using java.util.Scanner to search for a String in a String
By Java Tip in forum Java TipReplies: 0Last Post: 11-20-2007, 04:59 PM


LinkBack URL
About LinkBacks

Bookmarks