Advertisement
Guest User

Untitled

a guest
Dec 17th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. /**
  2. * do some operations with strings
  3. */
  4. void testStrings() {
  5. String text = "Shop is not very good place.";
  6. System.out.println(text.substring(3));
  7. System.out.println(text.indexOf('.'));
  8. System.out.println(text.charAt(15));
  9. }
  10.  
  11. /**
  12. * visualise some functions with locale and format
  13. */
  14. void testFormatAndLocale() {
  15. double price = 56655.34;
  16. System.out.printf("this price is %f \n", price);
  17. String francePrice = NumberFormat.getCurrencyInstance(Locale.FRANCE).format(price);
  18. String chinaPrice = NumberFormat.getCurrencyInstance(Locale.CHINA).format(price);
  19. System.out.println(francePrice + '\n' + chinaPrice);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement