Hello
Can I convert a string to a number? To convert for example a string to a float or a double.
“19,6” => 19.6
I search a method that return a double or a float.
thanks.
Hello
Can I convert a string to a number? To convert for example a string to a float or a double.
“19,6” => 19.6
I search a method that return a double or a float.
thanks.
You can try utils.stringToNumber() or the it2be_tools plugins…
It’s gotta be the plugin Marcel - utils.stringToNumber(‘19,6’) returns 196 which is probably not ideal for balancing the books
Graham Greensall
Hmm, if the client will pay you that amount I think the Servoy solution is waaaaaaaaay better… And I don’t like mentioning the plugin all over the place and that isn’t complete either. You would need a ‘de-tour’ that look this:
var nr = plugins.it2be_tools.numberFormat(“12,3”, “#.#”) * 1;
But the comma input as decimal delimiter is only allowed when the locale is set to accept it!
Thanks for your answers.
I created my plugin to convert string to number and other stuff.
I saw your menubar plugin, it’s very interesting. I’m trying to do something like that but it’s not easy to work with the UI of Servoy.
I saw your menubar plugin, it’s very interesting. I’m trying to do something like that but it’s not easy to work with the UI of Servoy.
When it would be easy I wouldn’t sell it…[/code]
and if we want to convert a number to a String? I can’t see a method in the Utils.
antonio google! ‘javascript number to string’…
btw the answer very simple ```
var nr = 123 + “”;
Ah, very simple, indeed. As Christofer Columbus once said, everything is simple once you know how to do it.
Marcel, one problem I’ve found with info from google is that the set of Java methods within Servoy doesn’t always allow me to implement solutions I find out there.
Marcel, one problem I’ve found with info from google is that the set of Java methods within Servoy doesn’t always allow me to implement solutions I find out there.
I don’t understand!
First of all we are not talking Java but JavaScript. Just a liiiiittle difference
Second, as far as I know the implementation of JavaScript in Servoy is pretty strait forward for most of its functionality. The only thing that you can not use (but you sure can learn from them) are the DOM Objects. A good starting point is JavaScript Tutorial.
(plink - Lights go on…)
Ah - JavaSCRIPT
I see it now - (doh)
Pointing out these important differences that, while not obvious to the new comer, are much appreciated and one of the great values of this forum.
Expect a decrease in the number of postings!
You’re welcome of course.
Maybe it is an idea, when it is really not obvious that we are talking JavaScript instead of Jave, to file it as a feature request or as an issue that the docs are more clear on that. For me it’s never been an issue because the first ‘meeting’ with Servoy was in a workshop and this was one of the first things that was brought up…
Again, have fun with Servoy and keep asking your question (after googling for them ).
Cheers,