java.text.spi


1. Getting an Instance of NumberFormat

NumberFormat numberFormat = NumberFormat.getInstance();

2. Setting the Currency

NumberFormat numberFormat = NumberFormat.getCurrencyInstance();
numberFormat.setCurrency(Currency.getInstance("USD"));

3. Formatting a Number as Currency

double amount = 1234.56;
String formattedAmount = numberFormat.format(amount); // "$1,234.56"

4. Parsing a Currency String

String currencyString = "$1,234.56";
Number parsedAmount = numberFormat.parse(currencyString); // 1234.56

5. Getting an Instance of DateFormat

DateFormat dateFormat = DateFormat.getInstance();

6. Setting the Date Format

DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL);

7. Formatting a Date

Date date = new Date();
String formattedDate = dateFormat.format(date); // "Friday, April 22, 2023"

8. Parsing a Date String

9. Getting an Instance of DecimalFormat

10. Setting the Decimal Format

11. Formatting a Number

12. Parsing a Number String

13. Getting an Instance of MessageFormat

14. Setting the Arguments

15. Formatting a Message

16. Parsing a Message

17. Getting an Instance of ChoiceFormat

18. Selecting the Format

19. Parsing a Formatted Message

20. Getting an Instance of Collator

21. Setting the Locale

22. Comparing Strings

23. Getting an Instance of Normalizer

24. Normalizing a String

25. Getting an Instance of BreakIterator

26. Setting the Text

27. Getting the Boundaries

28. Getting an Instance of CharacterIterator

29. Navigating the Characters

30. Getting an Instance of Locale

31. Getting the Language

32. Getting the Country

33. Getting an Instance of Currency

34. Getting the Currency Code

35. Getting an Instance of TimeZone

36. Getting the Time Zone ID

37. Getting an Instance of SimpleDateFormat

38. Setting the Time Zone

39. Formatting a Date

40. Parsing a Date String

41. Getting an Instance of DecimalFormatSymbols

42. Getting the Decimal Separator

43. Getting the Currency Symbol

44. Getting an Instance of MessageFormat

45. Setting the Pattern

46. Setting the Arguments

47. Formatting a Message

48. Parsing a Message

49. Getting an Instance of MessageFormat

50. Getting the Available Locales