Get the formated value back to original

2 posts, 0 answers
  1. Mark Hanson
    Mark Hanson avatar
    9 posts
    Member since:
    Oct 2012

    Posted 19 Jan 2012 Link to this post


    I set my culture in Romanian input


    Then, i set the value of a textbox like this

    $("#valueInput").val(kendo.toString(100000.25, "c"));  // creates "100.000,25 lei"

    How can i get the formated value back to original, but keeping the culture format? (without using the .kendoNumericTextBox plugin)

    For example, "100.000,25 lei"  changes to "100000,25"  (note that decimals separator is a coma , )

    Thank you
  2. Georgi Krustev
    Georgi Krustev avatar
    3747 posts

    Posted 20 Jan 2012 Link to this post

    Hello Mark,

    Here is a quote of the answer in the support ticket open on the same matter:

    Thank you for contacting us. In order to achieve your goal you will need first to parse the string and create Number from it. Then you can format it in the way you need:

    Copy Code
    //format to currency
    var formatted = kendo.toString(100000.25, "c");
    //get Number object
    var currency = kendo.parseFloat(formatted );
    //re-format the number
    var newFomarttedNumber = kendo.toString(currency, "n");

    Georgi Krustev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top