Click here to Skip to main content
16,005,552 members
Home / Discussions / Java
   

Java

 
GeneralInteracting COM dlls from Java using JNI Pin
Shamant31-Jul-01 23:36
Shamant31-Jul-01 23:36 
GeneralCommunicating with Javascript Pin
Robert Bushlow30-Jul-01 7:16
Robert Bushlow30-Jul-01 7:16 
Generalproblems using Image with netscape Pin
26-Jul-01 10:13
suss26-Jul-01 10:13 
Generalreport generation in java Pin
25-Jul-01 19:58
suss25-Jul-01 19:58 
Questionbyte or character stream? Pin
Flora23-Jul-01 15:19
Flora23-Jul-01 15:19 
GeneralStream Tokenizer Pin
Flora17-Jul-01 13:25
Flora17-Jul-01 13:25 
GeneralRe: Stream Tokenizer Pin
Malcolm McMahon18-Jul-01 3:50
Malcolm McMahon18-Jul-01 3:50 
GeneralRe: Stream Tokenizer Pin
Koundinya4-Aug-01 2:17
Koundinya4-Aug-01 2:17 
Assuming u have already tokenized the sentence using

StreamTokenizer st=new StreamTokenizer(ursentence);


while(st.hasMoreElements())
{

String dollarValue=(String)st.nextElement();

if(dollarValue.charAt(0)=='$')
{
String s="";
int i=0;
while(true)
{
if((dollarValue.charAt(i)>='0'&& dollarValue.charAt(i)<='9'))
{
s=s+dollarValue.charAt(i);
}
else if(dollarValue.charAt(i)=='.')
{
s=s+dollarValue.charAt(i);

}
else if(dollarValue.charAt(i)==' ')
{
System.out.println("invalid number format");
System.exit(1);
}
i++;
if(i==dollarValue.length())break;
}
System.out.println("This is ur number"+Integer.parseInt(s));
}

}



I.The above function assumes that there is $ sign at first position of the value and there are no spaces after $ sign.

II.The above program assumes that u r using integers for double values.


If the value is double use Double.parseDouble instead of Integer.parseInt



Cheers

Koundinya

Generalsorting class XYObjArray Pin
23-Jun-01 12:12
suss23-Jun-01 12:12 
QuestionHow can i use the UDP in the Web ?? Pin
khamis22-Jun-01 7:44
khamis22-Jun-01 7:44 
Questionscreen mate using java swing? Pin
18-Jun-01 0:39
suss18-Jun-01 0:39 
GeneralAlternative to Java Applets Pin
13-Jun-01 10:12
suss13-Jun-01 10:12 
GeneralRe: Alternative to Java Applets Pin
Dhandapani Ammasai13-Jun-01 13:45
Dhandapani Ammasai13-Jun-01 13:45 
GeneralRe: Alternative to Java Applets Pin
Jack Mott17-Jul-01 12:30
Jack Mott17-Jul-01 12:30 
GeneralRe: Alternative to Java Applets Pin
pushpi5-Oct-01 18:22
pushpi5-Oct-01 18:22 
QuestionJava swing with IE? Pin
13-Jun-01 10:10
suss13-Jun-01 10:10 
AnswerRe: Java swing with IE? Pin
17-Jun-01 18:37
suss17-Jun-01 18:37 
AnswerRe: Java swing with IE? Pin
pushpi5-Oct-01 18:30
pushpi5-Oct-01 18:30 
AnswerRe: Java swing with IE? Pin
Malcolm McMahon9-Jan-02 3:08
Malcolm McMahon9-Jan-02 3:08 
GeneralError Message Pin
xpwork12-Jun-01 15:24
xpwork12-Jun-01 15:24 
GeneralRe: Error Message Pin
boul21-Jun-01 14:40
boul21-Jun-01 14:40 
GeneralJava StandAlone Pin
8-Jun-01 6:26
suss8-Jun-01 6:26 
GeneralRe: Java StandAlone Pin
Malcolm McMahon26-Jun-01 23:41
Malcolm McMahon26-Jun-01 23:41 
Generaladsf Pin
7-Jun-01 17:48
suss7-Jun-01 17:48 
GeneralRe: adsf Pin
amit_ch26-Jul-01 21:54
amit_ch26-Jul-01 21:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.