How to convert Localized formatted String in Amount?

Hello All,
I have once scenario where I need to convert localized string amount to parse and make it long amount.
Example: In russia, people write 1000 as "1 000".
Now what I need to do is to parse this "1 000" and get 1000.
Is there any way in java, which can identify if the particular string is localized price in some Locale and give us the normal long output?
Thanks,
Jenish

The char after the 1 of 1 000 is not a space (value: 32) it's a no-break space (value 160). Copy this line and paste it into your code:System.out.println(nf.parse("1 000"));And please read the announcement(s) at the top of the forum listing, they're there for a purpose. Then edit your post and format the code correctly.
db
edit Dang, the forum parsing (or maybe the browser rendering) converts that to a normal space :( Trying again... and again ...
No, it appears both   and   are corrupted to a   no matter how I try it. One more try, with pre tags instead of code tags
System.out.println(nf.parse("1 000"));Nope. With noformat
{noformat}System.out.println(nf.parse("1 000"));{noformat}
On a Windows computer, you can type the no-break space using Alt-0160 or copy it from the Character Map. Other than that, here's my best attempt to illustrate what's going on:NumberFormat nf = NumberFormat.getInstance(new Locale("ru", "RU"));
try {
  System.out.println("1 000".equals(nf.format(1000))); // false
  String thousand = "1" + ((char) 160) + "000";
  System.out.println(thousand); // looks like 1 000
  System.out.println(nf.parse(thousand)); // 1000
} catch (ParseException e) {
  e.printStackTrace();
}Edited by: Darryl Burke

Similar Messages

  • How to convert byte into string

    can any tell me how to convert byte into string
    when im an debugging thid code in eclipse it shows the result in integer format instead of string but in command prompt it is showing result in string format..........plz help
    package str;
    import java.io.*;
    public class Testfile {
    public static void main(String rags[])
    byte b[]=new byte[100];
    try{
    FileInputStream file=new FileInputStream("abc.txt");
    file.read(b,0,50);
    catch(Exception e)
         System.out.println("Exception is:"+e);
    System.out.println(b);
    String str=new String(b);
    System.out.println(str);
    }

    Namrata.Kakkar wrote:
    errors: count cannot be resolved and Unhandled exception type Unsupported Encoding Exception.
    If i write an integer value instead of "count" then Unhandled exception type Unsupported Encoding Exception error is left.This is elementary. You need to go back to [http://java.sun.com/docs/books/tutorial/|http://java.sun.com/docs/books/tutorial/] .

  • How to convert date format dd.mm.yy into yyyymmdd?

    Hello experts,
    how to convert date format dd.mm.yy into yyyymmdd?
    Thanx
    Axel

    Hi
    go through these previous threads on similar question
    https://forums.sdn.sap.com/click.jspa?searchID=673529&messageID=1763194
    Date Conversion in Flat File
    converting the DATE(yyyymmdd) into MONTH(yyyymm) format
    Date Format Conversion from MM.DD.YYYY to YYYYMMDD
    gives clear idea
    Reagrds
    Kiran
    Message was edited by:
            ravi kiran naalla

  • How to convert Date format into day in ssrs reports?

    Hi
    How to convert date format into day?
    10/01/2010 as like Monday like that?

    =weekdayname(datepart("w",Fields!mydate.Value))
    -Vaibhav Chaudhari

  • How to convert Binary to String?

    Hi,
    How to convert Binary to String? Thank!

    Never ceases to amaze me how many people cannot
    accept any form of criticism whatsoever. How dothey
    get through the normal day? Do they pick fightswith
    everyone who says anything to them they don'tlike?
    Was this for me????Who are you calling a psycho??

  • How to convert date format to MM/DD/YYYY

    Hi,
       How to convert date format to MM/DD/YYYY.
    Thanks,
    Senthil

    hi,
    tri with this function module
    data :l_date(10) type c
    CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
    EXPORTING
       DATE_INTERNAL                  = SY-DATUM
    IMPORTING
       DATE_EXTERNAL                  = l_date.
    this function module converts date from 20050601 to external format  which is specified in user profile
    cheers,
    sasi

  • How to convert date format(mm/dd/yy) into dd-mm-yy

    I want to convert date format(mm/dd/yy) into dd-mm-yy
    like 12/23/06 into 23-sep-06

    hey, you can use SimpleDateFormat to format your date. this is sample code, maybe could help you.
    class dateFormat
         public static void main(String[] args)
              Date now = new Date();
              System.out.println("Before format : "+now);
              SimpleDateFormat sdf = new SimpleDateFormat( "dd-MM-yy" );//Change your date format in here.
              String display = sdf.format(now);
              System.out.println("After format : "+display);
    }If you already understand about my sample code, i think it's easy to make your own date format. Just modified few line of my code.

  • How to convert date format in VC 7.0 to DD.MM.YYYY

    Hi
      I am on VC 7.0.
      My requirment is to show Current date as a default value for a input field.
      I am using date function now() as default value...and it is displaying the current date
    08.07.2009 as  Jul 08,2009
    But my requirment is to display it as 08.07.2009
    Please update me how to convert the data format to be displayed as DD.MM.YYYY format
    Thanks

    Hi,
    Use DSTR method to change date format. Check the below link for details.
    http://help.sap.com/saphelp_nw70/helpdata/en/49/032e66f4a4105ee10000000a42189d/frameset.htm
    Regards
    Basheer

  • How to convert date format in XI? Help!

    Hi Experts,
    PIP is the input for XI.
    The PIP has date as : <DateTimeStamp>20030515T000000.000Z</DateTimeStamp>.
    How to convert it into MM/DD/YYYY format in XI? 
    Thanks
    Gopal

    hi,
    use two standard functions:
    <b>substring </b>(to take first 8 chars from this field)
    <b>DateTrans</b> to change 20030515 to MM/DD/YYYY
    http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm
    that's all you need to do very simple
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • How to convert media format?

    Hi All:
    Does any one know how to convert the media format in JMF?
    Is there any APIs or Demo about how to convert mp3,avi to the uncompressed wav format?
    In windows platform, we can use DirectShow APIs. It's a component of the DirectX SDK. DirectX can help us to decompress the video or audio from compressed format to uncompressed format
    (RGB for video, PCM for audio) and it supports streaming also.
    Is there any familar APIs in JMF or Opensource for Mac?
    Your feedbacks are highly appreciated!
    Best Regards,
    Tango

    Hi,
    You can set the codec chain in the Processor (during configured Stage) object which allow you to define your desired Codec, Multiplexer, etc.
    For more information, you can look at the JMF API Guide. Since I know that JMF doesn't come with mp3 codec, I think you have to download a codec pack called "ffmpeg" etc which add more Codec to JMF.
    About the Mac, I am sorry that I really don't know.
    Best Regards
    Ferdinand Ng

  • How to convert well format xml in coldfusion?

    Hi,
    I am consuming asp.net webservice in coldfusion.It returns xml but it is not in wellformat.
    Please suggest me how to convert to well format xml.
    Advance Thanks,

    chandra12345 wrote:
    I am consuming asp.net webservice in coldfusion.It returns xml but it is not in wellformat.
    Please suggest me how to convert to well format xml.
    Technically speaking, a piece of text must be well-formed before it can be called an XML document. So you cannot yet say the returned text is XML.
    The first thing to do is to check whether it is. Use, for example, isXml(someString) to check whether someString is well-formed XML.
    There is no one standard way to convert text to well-formed XML. This is because there are infinitely many ways in which text can fail to be well-formed. The easiest solution for you will be to learn the rules for well-formed XML.
    Any elementary book on XML will teach you that. If you find books old-fashioned, then you could instead google well-formed xml .

  • How to convert date format into sap standard format?

    Hi All,
    In SAPUI5 screen i have one simple form in form i have date field which is format  (MM/DD/YYYY). but i am getting POST error while inserting the data in to sap table.
    I want convert date format in sap format (YYYY/MM/DD).
    One more issue, when i am fetching the data from sap table,but  the date display with time and time zone.
    eg. Sat Aug 02 2014 05:30:00 GMT+0530 (India Standard Time)
    I want to display only date.
    Thanks,
    Prashant.

    Now i am using <DatePicker id="Emp_fsdate" displayFormat="yyyy-MM-dd"/>
    I checked in console, but date is display like mm/dd/yy
    In my controller.js file i have written code
    OData.request
               requestUri: "http:sap/opu/odata/sap/ZSERVICE_FINAL_SRV/es_sodata", 
               method: "GET",
               headers:
               "X-Requested-With": "XMLHttpRequest",
               "Content-Type": "application/atom+xml",
               "DataServiceVersion": "2.0",       
               "X-CSRF-Token":"Fetch"
           function (data, response){
            var header_xcsrf_token = response.headers['x-csrf-token'];
                       OData.request
                            requestUri:
                             "http://sap/opu/odata/sap/ZSERVICE_FINAL_SRV/es_sodata", 
                            method: "POST",
                            headers:
                          "X-Requested-With": "XMLHttpRequest",                     
                            "Content-Type": "application/atom+xml",
                            "DataServiceVersion": "2.0",
                            "Accept": "application/atom+xml,application/atomsvc+xml,application/xml",
                            "X-CSRF-Token": header_xcsrf_token
                            data:
                                   Empid:Emp_id,
                                   Empname:Emp_name,
                                   Start_Date:Emp_sdate,
    //                              End_Date:Emp_edate,
                                   Status:Emp_status,
                                   City:Emp_city,
                                   Location:Emp_location,
    and in my CREATE_ENTITY method
    method ES_SODATA_CREATE_ENTITY.
         DATA: ls_request_input_data TYPE zcl_zservice_final_mpc=>ts_et_sodata,
             ls_userinfo TYPE zsodata.
       DATA ls_temp TYPE sy-datum.
    * Read Request Data
       io_data_provider->read_entry_data( IMPORTING es_data = ls_request_input_data ).
    * Fill workarea to be inserted
       ls_userinfo-Empid   = ls_request_input_data-Empid.
       ls_userinfo-Empname   = ls_request_input_data-Empname.
       ls_userinfo-Start_Date   = ls_request_input_data-Start_Date.
       ls_userinfo-End_Date   = ls_request_input_data-End_Date.
       ls_userinfo-Status   = ls_request_input_data-Status.
       ls_userinfo-City   = ls_request_input_data-City.
       ls_userinfo-Location   = ls_request_input_data-Location.
    * Insert Data in table ZUSERINFO
       INSERT zsodata FROM ls_userinfo.
       IF sy-subrc = 0.
         er_entity = ls_request_input_data. "Fill Exporting parameter ER_ENTITY
       ENDIF.
       endmethod.
    But still i am getting an error
    POST http://sap/opu/odata/sap/ZSERVICE_FINAL_SRV/es_sodata 500 (Internal Server Error)
    I am able to insert all field except date field. How to insert date field in sap table.

  • How to convert Julian format date to regular date format

    Hi,
    I'm trying to convert Julian date(e.g. 2455657) passed to regular date format(e.g. 2011/4/6), but the Julian date is shown without conversion.
    I set the following code, and changed the format to "Date" with "yyyy/M/d" format, but "2455657" is displayed, not "2011/4/6".
    <?xdofx:to_date(HIRE_DATE_J,'J')?>
    I also set the following with "Text" format field, but it still shows "2455657".
    <?xdofx:to_char(to_date(HIRE_DATE_J,'J'),'YYYY/MM/DD')?>
    How can I convert Julian format to regular date format?
    Thanks in advance
    Toru

    Take a look at the following post: http://blogs.oracle.com/xmlpublisher/2007/08/more_date_calculations.html
    and look at the comments section. Based on the comments, it appears that you can not convert from Julian format and you would have to do this in your query.
    Thanks,
    BIPuser

  • How to convert number to string in java

    hi how can i convert number to string in java
    something like
    public void Discription(Number ownerName){
    String.valueOf(ownerName);Edited by: adf009 on 2013/04/08 7:14 PM

    Yet another way of doing it is: ownerName.toString().
    If you are working in and IDE such as Netbeans or Eclipse, type a period after the object name. Wait a second or so. Eclipse/Netbeans Intellisense will show you a list of functions that object provides that you can choose from. toString() is one of them.

  • How to convert LongRaw to String when querying using DB Adapter?

    Hi All,
    How do we use a DB Adapter to query on LONG Raw data? Is there a way to implicitly convert data to a string before returning the resultSet?
    JDev: 11.1.1.4
    Regards.

    Hi,
    LONG RAW data will be retrieved as base64binary, you can use and Embed Java to convert it back to string.
    How to convert String to base64Binary in BPEL process
    Or you can use doTranslateFromNative oracle extension function, you will need a NXSD template to use it.
    http://docs.oracle.com/cd/E15523_01/integration.1111/e10224/bp_appx_functs.htm#CJACABGA
    Cheers,
    Vlad

Maybe you are looking for