bonjour tout le monde
j'ai problème avec la virgule qui ne fonctionne pas bien
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
 
final String french =
	        // the main rule set
	        "%main:\n"
	               // negative-number and fraction rules
	        + "    -x: moins >>;\n"
	        + "    x.x: << virgule >>;\n"
	               // words for numbers from 0 to 10
	        + "    z\u00e9ro; un; deux; trois; quatre; cinq; six; sept; huit; neuf;\n"
	        + "    dix; onze; douze; treize; quatorze; quinze; seize;\n"
	        + "        dix-sept; dix-huit; dix-neuf;\n"
	               // ords for the multiples of 10: %%alt-ones inserts "et"
	               // when needed
	        + "    20: vingt[->%%alt-ones>];\n"
	        + "    30: trente[->%%alt-ones>];\n"
	        + "    40: quarante[->%%alt-ones>];\n"
	        + "    50: cinquante[->%%alt-ones>];\n"
	               // rule for 60.  The /20 causes this rule's multiplier to be
	               // 20 rather than 10, allowinhg us to recurse for all values
	               // from 60 to 79...
	        + "    60/20: soixante[->%%alt-ones>];\n"
	               // ...except for 71, which must be special-cased
	        + "    71: soixante et onze;\n"
	               // at 72, we have to repeat the rule for 60 to get us to 79
	        + "    72/20: soixante->%%alt-ones>;\n"
	               // at 80, we state a new rule with the phrase for 80.  Since
	               // it changes form when there's a ones digit, we need a second
	               // rule at 81.  This rule also includes "/20," allowing it to
	               // be used correctly for all values up to 99
	        + "    80: quatre-vingts; 81/20: quatre-vingt->>;\n"
	               // "cent" becomes plural when preceded by a multiplier, and
	               // the multiplier is omitted from the singular form
	        + "    100: cent[ >>];\n"
	        + "    200: << cents;\n"
	        + "    201: << cent[ >>];\n"
	        + "    300: << cents;\n"
	        + "    301: << cent[ >>];\n"
	        + "    400: << cents;\n"
	        + "    401: << cent[ >>];\n"
	        + "    500: << cents;\n"
	        + "    501: << cent[ >>];\n"
	        + "    600: << cents;\n"
	        + "    601: << cent[ >>];\n"
	        + "    700: << cents;\n"
	        + "    701: << cent[ >>];\n"
	        + "    800: << cents;\n"
	        + "    801: << cent[ >>];\n"
	        + "    900: << cents;\n"
	        + "    901: << cent[ >>];\n"
	        + "    1000: mille[ >>];\n"
	               // values from 1,100 to 1,199 are rendered as "onze cents..."
	               // instead of "mille cent..."  The > after "1000" decreases
	               // the rule's exponent, causing its multiplier to be 100 instead
	               // of 1,000.  This prevents us from getting "onze cents cent
	               // vingt-deux" ("eleven hundred one hundred twenty-two").
	        + "    1100>: onze cents[ >>];\n"
	               // at 1,200, we go back to formating in thousands, so we
	               // repeat the rule for 1,000
	        + "    1200: mille >>;\n"
	               // at 2,000, the multiplier is added
	        + "    2000: << mille[ >>];\n"
	        + "    1,000,000: << million[ >>];\n"
	        + "    2,000,000: << millions[ >>];\n"
	        + "    1,000,000,000: << milliard[ >>];\n"
	        + "    2,000,000,000: << milliards[ >>];\n"
	        + "    1,000,000,000,000: << billion[ >>];\n"
	        + "    2,000,000,000,000: << billions[ >>];\n"
	        + "    1,000,000,000,000,000: =#,##0=;\n"
	        // %%alt-ones is used to insert "et" when the ones digit is 1
	        + "%%alt-ones:\n"
	        + "    ; et-un; =%main=;";
 
 
String data="235.235";
double somme = Double.parseDouble(data);
RuleBasedNumberFormat rbnf = new RuleBasedNumberFormat(french, Locale.FRANCE);
 
data ="Arret le present etat  à la somme "+rbnf.format(somme);
System.out.println("lorsque je regarde    "+data);
résultat n'est pas juste au lieu de m'afficher deux cent trente-cinq virgule deux cent trente-cinq

alors ça affiche
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
deux cent trente-cinq virgule deux trois cinq