Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 04-05-2003, 08:01 PM   #1 (permalink)
Apodysophilia
Regular Contributor
 
Apodysophilia's Avatar
 
Join Date: Apr 2003
Location: noWhere, PA
Posts: 104
Apodysophilia is on a distinguished road
Send a message via AIM to Apodysophilia
Input and out put, Q&A

i know how to do it with int, chara, and double. but how do i do it with String?? and do you know a better way to do it?? and how do i use the use code brackets??, untill i learn i will us the [ SHELL] ones becase it looks good


[SHELL]
private int intValue () throws IOException
{
int value;

BufferedReader input = new BufferedReader( new InputStreamReader( System.in) );

String inputStr;
inputStr = input.readLine();
StringTokenizer sTok = new StringTokenizer ( inputStr);
value = Integer.parseInt( sTok.nextToken() ) ;

return value;
}

[/SHELL]
Apodysophilia is offline   Reply With Quote
Old 04-06-2003, 02:51 PM   #2 (permalink)
abc123
bloomberg
 
abc123's Avatar
 
Join Date: Jun 2002
Location: bloomberg
Posts: 263
abc123 is on a distinguished road
Send a message via AIM to abc123 Send a message via Yahoo to abc123
what do you mean how do you do it with string? you've just done it there, except you changed it to an integer...

String inputStr;
inputStr = input.readLine();

that reads until you press enter, then returns the string

...
.... ?

and you use the [c0de] tags exactly the same as the [sh3ll] ones..

Code:
// hmm
__________________
-- bloomberg.
abc123 is offline   Reply With Quote
Old 04-08-2003, 07:01 AM   #3 (permalink)
Apodysophilia
Regular Contributor
 
Apodysophilia's Avatar
 
Join Date: Apr 2003
Location: noWhere, PA
Posts: 104
Apodysophilia is on a distinguished road
Send a message via AIM to Apodysophilia
but do i need
Code:
StringTokenizer sTok = new StringTokenizer ( inputStr); 
          value = Integer.parseInt( sTok.nextToken() ) ;
only without the interger.parseInt
Apodysophilia is offline   Reply With Quote
Old 04-08-2003, 02:13 PM   #4 (permalink)
abc123
bloomberg
 
abc123's Avatar
 
Join Date: Jun 2002
Location: bloomberg
Posts: 263
abc123 is on a distinguished road
Send a message via AIM to abc123 Send a message via Yahoo to abc123
what kind of resposne are you trying to get? if you want the message in word-based chunks ( split up on spaces ) then thats the right way to go about it.
__________________
-- bloomberg.
abc123 is offline   Reply With Quote
Old 04-08-2003, 02:33 PM   #5 (permalink)
Apodysophilia
Regular Contributor
 
Apodysophilia's Avatar
 
Join Date: Apr 2003
Location: noWhere, PA
Posts: 104
Apodysophilia is on a distinguished road
Send a message via AIM to Apodysophilia
i ment i wouldnt have to change it to something like
Code:
String.parseString
Apodysophilia is offline   Reply With Quote
Old 04-08-2003, 02:36 PM   #6 (permalink)
abc123
bloomberg
 
abc123's Avatar
 
Join Date: Jun 2002
Location: bloomberg
Posts: 263
abc123 is on a distinguished road
Send a message via AIM to abc123 Send a message via Yahoo to abc123
did you even try it?

obviously not.

no; you would not need to do that, it doesn't make sense...
__________________
-- bloomberg.
abc123 is offline   Reply With Quote
Old 04-08-2003, 03:47 PM   #7 (permalink)
Apodysophilia
Regular Contributor
 
Apodysophilia's Avatar
 
Join Date: Apr 2003
Location: noWhere, PA
Posts: 104
Apodysophilia is on a distinguished road
Send a message via AIM to Apodysophilia
Quote:
Originally posted by abc123
did you even try it?

obviously not.

no; you would not need to do that, it doesn't make sense...
sorry, i didnt
Apodysophilia is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 10:03 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting