Skip to main content

how can I convert String to Integer?

4 replies [Last post]
tengimon
Offline
Joined: 2008-06-23

Hi,
I am having an issue with converting a string value to integer in JFX. I thought it is possible to call all java libraries, classes. I'm not a real java programmer, but what I've seen on the web was to use parseInt(). but this didn't work.
--------here is what i wrote-------------

import java.io.*;
import java.lang.*;

operation convert(){
var s= "123";
var i = Integer.parseInt(s); //<-- shows error here, i also tried "var i = parseInt(s);" <--this didn't work either
System.out.println("{i}");
}

the error message shows: No matching java method found for java.lang.Number.parseInt(java.lang.String)

Can anybody give a hand on this one?
Thanks a bunch

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
pedro22
Offline
Joined: 2008-06-17

hi,
i cant convert String values in Integer.
Why? is it because my jdk or the plugin?
what are newest eclipse plugin for eclipse?

tengimon
Offline
Joined: 2008-06-23

I don't think there are any latest javafx plugins for eclipse. As far as i know, the new ones are for NetBeans. btw i use jdk6u10.

tengimon
Offline
Joined: 2008-06-23

Thanks, it works now

alexsch
Offline
Joined: 2007-07-12

That works in the compiler version of JavaFX Script language:

[code]
import java.lang.System;

var s= "123";
var i = java.lang.Integer.parseInt(s);
System.out.println("{i+1}");
// output: 124
[/code]

http://openjfx.java.sun.com
http://javafx.netbeans.org/download-compiler-JFXplugin.html