I18N- Problems in Internationalization of numbers

I am trying to internationalize numbers.
Question 1: In the code when I try to parse "1,2,3,4,5.67" in US locale it is not throwing parse exception even though i have invalid position of group separators(,) in this String. How do we handle this?
Question 2: Is it mandatory to check if (form instanceof DecimalFormat) when using NumberFormat.getInstance() DOes this Factory method produce any other Format object? If yes How do we handle the else part?
import java.text.NumberFormat;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.ParsePosition;
import java.util.Locale;
public class testNumberParsing {
public static void main(String[] args) {
String parseStr = "1,2,3,4,5.67";
Locale locale = Locale.US;
try
  Number parseNumber = parseNumber(locale,parseStr);
  System.out.println("Parsed Number: < "+parseNumber+" >");
catch(ParseException pe)
  System.out.println(pe.getLocalizedMessage());
public static Number parseNumber (Locale clientLocale,
                                  String numberStr )
           throws ParseException
NumberFormat form = NumberFormat.getInstance(clientLocale);
System.out.println(form.getClass());
if (form instanceof     DecimalFormat)
  DecimalFormat formatter = (DecimalFormat) form;
  formatter.setGroupingUsed(true);
  System.out.println(" Grouping Size "+ formatter.getGroupingSize());
  ParsePosition parsePos = new ParsePosition(0);
  Number parsedNumberObj = (Number) formatter.parse(numberStr,parsePos);
   if (numberStr.length() != parsePos.getIndex())
    String parseExceptionMsg = "Parse Error while parsing String: <"+
                              numberStr +
                              " > at Character Position "
                              +parsePos.getIndex();
     throw new ParseException(parseExceptionMsg,parsePos.getIndex());
   return parsedNumberObj;
  else
   form.setGroupingUsed(true);
   ParsePosition parsePos = new ParsePosition(0);
   Number parsedNumberObj = (Number) form.parse(numberStr,parsePos);
   if (numberStr.length() != parsePos.getIndex())
    String parseExceptionMsg = "Parse Error while parsing String: <"+
                                numberStr +
                              " > at Character Position "
                              +parsePos.getIndex();
     throw new ParseException(parseExceptionMsg,parsePos.getIndex());
    return parsedNumberObj;

Hi,
As my context attribute is of type string, i can pass the whole string and iam getting the same as expected.
As far as your context attribute is of type you can give a try with the following approaches one is by specifying a format for this in the dictionary type or else formatting using code.
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html
Regards
Ayyapparaj

Similar Messages

  • Haven't been able to use pages for a while.  Keep getting following message.  Have tried reinstalling iWork, but no luck.  Same problems with Keynote and Numbers/Users/scottmcdonald/Desktop/Screen Shot 2012-03-14 at 9.39.52 PM.png

    Haven't been able to use pages for a while.  Keep getting following message.  Have tried reinstalling iWork, but no luck.  Same problems with Keynote and Numbers/

    Have you moved Pages from its installed location? Or just dragged a copy to your current system?
    It can't find some of its resources apparently.
    Peter

  • Problem when create auto numbering in BP master using Formatted Search

    Hi all,
    I have a problem in creating auto numbering in BP for Customer type using Formatted search
    My query is like this
    declare @tempNo as char(20)
    set @tempNo=(select  Isnull(max(REPLACE(OCRD.CardCode , LEFT(OCRD.CardCode,10),'')),0)  + 1
    from OCRD where (CardType ='C') and LEFT(OCRD.CardCode,3) = 'CU.' )
    set @tempNo='CU.'left(convert(varchar,GETDATE(),112),6)'.'+@tempNo
    select cast(@tempNo as char(20))
    It should be creating the new number for example
    CU.201101.1
    CU.201102.2
    CU.201103.3
    CU.201103.4
    The format will be like this CU.YYYYMM.autonumbering
    So if the current year is still the same it will always increase the number and it will reset the number become 1 if the current year is change.
    But when i execute the number , the number doesn't increase, still generate the last number CU.201103.4
    I have use this query in generate item number, it runs well but different format.
    Is there some thing wrong with my query?
    Thanks in advance
    Regards
    Jia shun

    Hi Jia shun,
    You have posted an identical threads. There is no such need. Please close this one and response to the one with answer already.
    Thanks,
    Gordon

  • I am having problems because two phone numbers are on the Apple ID, how do I choose one for imessage?

    I am having problems because two phone numbers are on the Apple ID, how do I choose one for imessage?

    Hello,
    In my opinion, this is the best procedure to use to update your BB OS:
    http://supportforums.blackberry.com/t5/BlackBerry-Device-Software/How-To-Reload-Your-Operating-Syste...
    However, the official download site:
    http://us.blackberry.com/support/downloads/download_sites.jsp
    shows your installed OS to be the current version from your carrier. Therefore, how your friends got a newer OS is a question to ask them and/or your carrier.
    You are, of course, free to use (via the above procedure) any carriers OS package...if another has the newer OS you want, you can use it. If you choose to do so, then simply insert, between steps 1 and 2 in the above procedure, the deletion, on your PC, of a file named VENDOR.XML
    Good luck.
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Problems in Internationalization

    Hi All,
    I am trying to internationalize an existing application developed using WDJ. I have created the language specific texts and added them as an .xlf file. The problem is that the texts are not changing even after i change the browser language to German.
    However, after changing the language from English to German, the portal home page texts are getting converted to German, but my application is not getting affected.
    I tried reloading, rebuilding the project. But still no change. But if I create a new project and repeat the process it works. Please let me know if there is any other steps which I have missed out.
    Regards,
    Poojith MV

    HI Pojith
    When we are doing I18N for that Application. Go to Navigator Tab
    Here Select Particular Projects--à src-àPackages-àsap-àvijay
    To internationalize the Web Dynpro application, copy the automatically generated *.xlf files and save them under a new name in the same directory.
    The new name must meet the following convention:
    u2022 .xlf
    For example, if you are creating *.xlf files for German,
    Use the language key de.
    Here Click on OK
    After that we can edit and translate these new *.xlf files in the S2X Editor.
    ApplyTemFirstView.wdview_de.xlf-àClick on Resource Text Tab
    Select Particular Text and Change the language to German-àClick on EDIT Button
    Here Enter German Lang-àClick on OK
    Now Go to Web Dynpro Explorer Tab
    Select Project-àRC Click on Rebuild Project
    Select Project-àRC Click on Reload
    Then Deploye the Application
    How to Check in Explorer. It is converting to German Language or not
    Open Internet Explorer
    Tool-àInternet Options -àClick on Languages Button-àClick on ADD Button
    Select German Language--àClick on OK
    Now We will Check in Portal
    Created Web Dynpro iView in Portal. That iView assign to the particular WorkSet-àAssign to Role
    Select that user Can Change Language
    Regards
    Vijay Kalluri

  • Problem with index of numbers in BSP Front end

    Hello All,
    I am facing the below problem. Request your help.
    Scenario: When I am trying to add the projects in the Front end , I am facing the problem with the index of numbering of the projects.
    Example: If I am adding 6 projects ( at the max only 4 on each page i-e there are 2 pages ), then the index is wrongly numbered and the arrow (for direction of the pages) are wrongly displayed. The direction of the arrow is pointed to the next page rather pointing to the previous page and the index of numbering of the pages is wrong.
    Request you to please suggest if this is any code fault in the table maintainance activity in the backend (BSP).

    Hi Irina,
    If you mean the number range is skipping 10 numbers in between runs then its because of the buffering in the number range.
    To avoid the buffer influencing the number range, pass
    'X' to the function module parameter: IGNORE_BUFFER.
    This should resolve the problem.
    Cheers,
    Aditya

  • Synching problems with pages and numbers

    After an initial problem with synching which was resolved with Yosemite Pages and Numbers have been synching across all my devices for a couple of weeks and now all of a sudden they have stopped again!! They synch across my phones and iPad but not to my macbook pro!! Very very annoying! How do I resolve it?

    Found a solution, but it is odd:
    On the 2008 Mac Pro, I UNCHECK the boxes beside Pages and Numbers in System Preferences > iCloud > iCloud Drive > Options. Now Pages and Numbers will properly save edited documents to the appropriate folders on iCloud Drive.
    Go figure ...
    Hope that this helps someone else.
    Jon

  • ID CS5 - problem with 2 page numbers in the same page

    Until InDesign CS3 I could put 2 page numbers in one page, either in document pages or in master pages, using 2 linked text frames, one in each of the pages I wanted to see the numbers. And this worked fine!
    In CS4, this stopped working in master pages. I had to override the text frames from master pages (ctrl/cmd + shift click on the text frames) to get this working, and I had to this in ALL document pages.
    I was hoping this problem was solved in CS5 but... the problem got worst!!! Now, not only I have to override the text frames, but I have to erase the markers and put them there again. Which means I have to put page markers individually in ALL pages.
    I wonder if there is a new way to do this? Does any one have the answer?...
    If not... I really really hope someone from Adobe reads this forum and try to solve the problem, because this is a great inconvenience...
    Thanks for any help

    Hi, Jongware,
    It is a bug since CS4, agravated in CS5, because until CS3 it worked very well.
    In fact, it worked through out a lot of pages. I think this was not created only to pages side-by-side but in fact to those articles that continued several pages ahead. So, in a magazine, when one has to break an article and continue this article in other page, one could (and still can) put a text frame in the of the first part of the article and type "Continue on [next page marker]". Then link this text frame with a new text frame on the page where the article continues, (on top of 2nd part of the article) and type "Continued from [previous page marker]".
    This situation – where text frames are in the document pages – still works fine.
    The problem is when this is a constant and you want to put it in master pages, and now it simply does't work. I mean, when every odd or even pages have both numbers. For me, it's a major problem, because several of my clients just love this!
    Is anyone of Adobe reading this? Are you going to help us and fix this problem, please?...

  • Problem with importing decimal numbers in Apex

    Hi,
    I have a ascii data file which I load into db tables calling a procedure in a db package.
    Executing the procedure by SQL Plus everything works fine.
    Calling the procedure by Apex button I get a "ORA-01722: invalid number; Error inserting subject" because of the decimal numbers in the data file. Taking the decimal numbers out of the file it works.
    - I tried with different formats in the data file like: 4.40 4,40 4.4 4,4: Makes no difference.
    - In Apex I tried column formatting in the report attribute: 999G999G999G999G990D00: Makes no difference, it's obviously only formatting the display.
    - Debug mode just shows there is an error..
    - The db column is of format NUMBER(10,2)
    As I mentioned, with SQL Plus it works no matter of the number format in the data file.
    Anybody has an idea where the problem might be?
    Help is greatly appreciated,
    Roger

    Hi Joel,
    Thanks for your reply. You were right, the NLS setting for the decimal separator in SQL*Plus is a , (komma) and in Application Express a . (point).
    I suspected a NLS problem that's why I tested with different formats in the data file (4.40 4,40). Shouldn't that make a difference?
    Now, to fix it: I didn't see in Apex any NLS settings, I checked in utilities and shared components. So, the way to do that is to directly write into SQL Workshop / Apex?
    ALTER SESSION SET NLS_NUMERIC_CHARACTERS=",' "
    Cheers,
    Roger

  • Problem with generating of numbers NUMBER_GET_NEXT

    Hi,
    I need to generate numbers for Project-Id. I've created a number range object (SNRO) NR_PROID (Settings: number length domain: numc10, No. of numbers in buffer: 10) with interval 01: 0000000001 - 9999999999, current number 100.
    I use it in the FM NUMBER_GET_NEXT:
    CALL FUNCTION 'NUMBER_GET_NEXT'
        EXPORTING
          NR_RANGE_NR = '01'
          OBJECT = 'NR_PROID'
          IMPORTING
            NUMBER = PROJID_TEMP
            EXCEPTIONS
              INTERVAL_NOT_FOUND = 1
              NUMBER_RANGE_NOT_INTERN = 2
              OBJECT_NOT_FOUND = 3
              QUANTITY_IS_0 = 4
              QUANTITY_IS_NOT_1 = 5
              INTERVAL_OVERFLOW = 6
              BUFFER_OVERFLOW = 7
              OTHERS = 8.
    But I always get numbers from 0 to 9, and then 0, 1, ...9 again. Each time increases the current number of the object's interval (10 numbers).
    However if I test the FM NUMBER_GET_NEXT with my object NR_PROID (SE37) it works fine.
    Does anybody know, what the reason could be?
    Thank you in advance.
    Irina
    Edited by: Irina Ziegler on Feb 6, 2008 10:08 PM
    Edited by: Irina Ziegler on Feb 6, 2008 10:08 PM

    Hi Irina,
    If you mean the number range is skipping 10 numbers in between runs then its because of the buffering in the number range.
    To avoid the buffer influencing the number range, pass
    'X' to the function module parameter: IGNORE_BUFFER.
    This should resolve the problem.
    Cheers,
    Aditya

  • Problems with Pages and Numbers using iCloud Drive on early 2008 MacPro, Yosemite

    One of my computers, an early 2008 MacPro running Yosemite, will NOT save Pages or Numbers documents to iCloud Drive from within those applications.  I see the little iCloud Drive error badge next to the file name in Finder after I try to save.  However, on the SAME computer I can save Pages and Numbers documents to a local drive (e.g., to my Desktop) and then use the Finder to drag the documents to iCloud Drive successfully.  Another computer, a MacBook Pro running Yosemite, has no problems using iCloud Drive to create, edit and then save Pages and Numbers documents stored on iCloud Drive.  I have tried "turning off" iCloud Drive for Pages and Numbers in System Preferences on the Mac Pro and then turning it back on to no effect.  I have also logged out of iCloud Drive on all of my devices (which include two iOS devices) and then logging back in to ensure that I'm using the same login id on all devices, again with no apparent change.
    Any suggestions for my next steps in attempting to solve this issue?  Is there any way to get more information about precisely what type of error is occurring?  Hovering over the badge only shows "Error".
    Thanks in advance.
    Jon

    Found a solution, but it is odd:
    On the 2008 Mac Pro, I UNCHECK the boxes beside Pages and Numbers in System Preferences > iCloud > iCloud Drive > Options. Now Pages and Numbers will properly save edited documents to the appropriate folders on iCloud Drive.
    Go figure ...
    Hope that this helps someone else.
    Jon

  • Problem with opening a Numbers document

    I have a problem with a Numbers document, which I created 3 weeks ago and step by step extended with additional functionality. I'm not anymore able to open the document. I can rename the document and maybe - I didn't try - delete the document. But when I'm clicking on the file's icon, the error message appears "Tabelle kann nicht geöffnet werden". It seems that the file is defect but how I it be revived. What steps I have to do to re-open the document?

    Check out that thread if you find it helpful. There are some cool ideas there.
    Adding a font to pages for Ipad

  • Problem with autoformat in Numbers

    When I type some numeric values in Numbers, like for instance "0.1", I get them autoformatted to time format: "00:01". It happens with decimal numbers with one or two decimal digits: "0.23" becomes "00:23", etc. If I change format from "Automatic" to "Numbers" after this auto-conversion, I get the complete date: "05/06/2012 00:23:00" instead of the original "0.23" value. So the only way to get the numeric value as I want it is to change the format BEFORE I enter the value. But this can be a problem if I have to import several TAB-formatted text files, because I have to edit all wrong cells one by one after importing. Strangely, I haven't found anybody reporting this kind of problem. Any idea what is happening and how to solve it? Thanks

    "Open a blank numbers document.
    Pick a cell and enter the number 12
    On the inspector cell format dialog select % (percent) \\ my default was automatic setting
    I see the cell contents change from 12 to 1,200% ( and it is left justified in the cell after formatting)"
    I see the display of the contents change from 12 (aligned right) to 1,200% (aligned right). This is correct.
    "Now change the format to date (and time)..."
    The displayed value remains "1,200%" (but aligned left).
    Interpretation:
    When the number 12 is entered, the display and the entry box both show "12"
    "Per cent," literally translated, means "per hundred;" a "percentage" is a conventional way of expressing a fraction: n% equals n in 100, or n/100.
    "Twelve per cent" is not "12." It is 12/100, which can be expressed as a decimal number as 0.12.
    When you change the format of the cell containing 12, you do not change the value in that cell.
    12 is still 12, but now it is being displayed as 'a number divided by 100'. The number, divided by 100, that will produce the value 12 is 1200. "12" is "1200%"
    So when the cell is formatted as Percentage, the display in the cell changes to "1200%". But the display in the entry box changes as well, to 1200%.
    "Now change the format to date and I see, and you too I hope, will see the same number 1,200% only right justified after formatting"
    I see that value, but it is aligned left, which indicates to me that Numbers is 'seeing' 1200% in the entry box as Text. The Automatic alignment for Text is left. I suspect Numbers attempts to interpret the value in the entry box as a date and time value, but fails due to the percent sign. Without the sign, 1200 can be interpreted as a Date and Time (December 25, 1199, 00:00:00); with the sign, even though the sign is applied by (a previous) formatting, it can't, and falls back to a text interpretation.
    "12" can also be interpreted by Numbers as a date. Setting the format of a cell containing 12 to Date and Time produces: January 1, 2012 12:00:00 AM
    If that cell is then set to "Percentage", the date remains, but alignment shifts for the default right (for numbers and Date & Time values) to left (for text). Looks like the same thing going on—the content is being read as text, the text can't be interpreted as the type of value required for the formatting to apply, so the value is treated as text, and the default alignment for text is applied.
    "I (am) not sure how I can make use of entering the number twelve and change the format to percent to get 1,200%. I (would) like the outcome to be 12 percent."
    If you want the outcome to be 12%, then you need to enter 0.12 (12 hundredths), or you need to enter 12%. The former will require your changing the format to Percentage; the latter will be recognized as a percent, and automatically formatted to show percentage.
    If you still consider this a bug, you should Provide Numbers Feedback, and make a bug report. You'll find Provide xxx Feedback in the Application menu (in Numbers, the "Numbers" menu) of current Apple Software.
    Regards,
    Barry

  • Problems with formatting negative numbers in Reports PDF web output.

    Hi,
    I have a problem where all the values in a column are right-aligned. The values are all numbers. If a value is negative, then the value is placed a character to the left, putting it out of alignment with the non-negative values. I can't figure out why this would be.
    The problem doesn't appear in Reports Builder, or when the Report is generated to a PDF: File > Generate to file > PDF.
    The problem only appears when the Report is called through the web application we've created for our client. It is output to a .pdf in a web browser- Internet Explorer 6.
    I am running Oracle 10g.
    Any ideas on solving this?
    Regards,
    James Sharman.

    Just some clarification-
    in Reports Builder, the values look like this:
    100.50
    100.00
    -100.00
    100.00
    but when running from the web application, they go wierd and look like this:
    100.50
    100.00
    -100.00
    100.00
    Regards,
    James Sharman.

  • Problem with entering integer numbers from keyboard

    I have written this simple code:
    import java.io.*;
    public class Simple{
         public static void main(String[] args)throws Exception{
              System.out.println("Enter two integer numbers: ");
              BufferedReader enter=new BufferedReader(new InputStreamReader(System.in));
                   int first=Integer.parseInt(enter.readLine());
                   int second=Integer.parseInt(enter.readLine());
              System.out.println("Result is: "+(first+second));
    and it works fine if I type first number, press Enter, then type
    second number and press Enter.
    But if I type in one line: 2 3 (with space between) I get run-time error:
    Exception in thread "main"...bla...bla at java.lang.Integer.parseInt(Integer.java)...
    I know that error is coming from Integer.parseInt(string) in my code, but I
    don't know how can I avoid it.
    In C that is rather simple scanf("%d %d",&first,&second), but in Java it's much more
    complicated.
    Do you have any suggestions how to solve this problem?

    store the user input in a string
    use a StringTokenizer st
    then
    while(st.hasNext())
    int first=Integer.parseInt(st.nextToken());
    but you should really catch a NumberFormatException
    walker

Maybe you are looking for

  • Software update, nothing but headaches.....

    About two weeks ago, I woke up to a message on my phone that said a software update had been downloaded and the phone needed to restart to install. I wish I'd known then what a headache this was going to cause me. A few days later I noticed that my p

  • Hard drive failure with OSX 10.4.3 + 10.4.4

    Not sure if it is related to 10.4.3, 10.4.4., or my attempt to connect to a Windows server? I have had Had 2 hard drive failures since yesterday(bad node)on an old G4 + a G5. Disk Utilities could not repair it. FSCK could not be run. I was able to fi

  • Pc to Mac - Gaming on a mini

    Hello, I'm totally new to the Mac world and love the look of it. I've been a PC user for a decade and would like to make the switch, and mainly because I want a machine to do work (print and web design) and less gaming. BUT I would like to be able to

  • Banshee SVN - GDATASHARP

    Hi all, I am trying to install Banshee from SVN directory using git ( git clone git://git.gnome.org/banshee ) I am however running into a corner as I am missing GDATASHARP (see terminal error below) checking for GDATASHARP... no configure: error: Pac

  • Webdynpro ABAP, table TreeByNestingTableColumn

    Hi I have a table defined as a TreeByNestingTableColumn. I need to change the icon displayed in the table. I used WDDOMODIFYVIEW method to get the data with method get_static_attributes and then set.. But it is possible only to change the first row..