scala - How to print $ using String Interpolation -


this question has answer here:

i have started learning scala .i want print $ using string interpolation

def main(args:array[string]){ println("enter string") val inputstring:string=readline() val inputasdouble:double=inputstring.todouble printf(f" owe '${inputasdouble}%.1f3 ") } 

input 2.7255 output .you owe 2.73 while want owe $2.73 pointers of great help

just double it

printf(f" owe $$${inputasdouble}%.1f3 ") 

result:

16/06/02 10:16:04: owe $2,73 

Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo