Underscores in numeric literals in scala -


apparently scala not support jdk7 , later underscores in numeric literals?

i using jdk 8

scala> system.getproperty("java.version") res0: string = 1.8.0_40 

here try use jdk7 (and later) numeric literal:

scala> val x = 1_000_000 <console>:1: error: invalid literal number        val x = 1_000_000                ^ 

is there scala language option this?

in scala land may have seen things like:

s"my name $firstname" 

and

sql"select id, name members id = ${id}" 

there's no reason not have:

i"1 000 000" 

or even:

animal"dog" // checks dog on list of animal words 

there no i string interpolation built in scala library can use:

implicit class intcontext(val sc: stringcontext) {   def i(args: any*): int = {     val orig = sc.s(args: _*)     orig.replace(" ", "").toint   } }  i"1 000 000" // res0: int = 1000000 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -