• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

is there a way to format multiple strings with one variable?  RSS feed

 
Ranch Hand
Posts: 424
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a load of strings with floats and ints that need to be formatted to 2 decimal places and moved across the screen

i know that this line formats subTotal to 2 decimal places


is there a way you can use a variable like this


and apply it to multiple variables?

i tried a few things but just got errors

or does this line have to be applied to every line you want to format

like:





 
jon ninpoja
Ranch Hand
Posts: 424
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
also is there a way to add a currency symbol like $ or € to the format so that it puts it before the float
 
Cob is sand, clay and sometimes straw. This tiny ad is made of cob:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!