Convert String to Integer or int

By neokrates, written on April 14, 2010

groovy   snippet

  • Join date: 11-30-99
  • Posts: 224
View Counter:
  • 3,566 views
Rate it
Ad
Poll
  • What tools do you use for site design?

    View Results

    Loading ... Loading ...
Feeds:
  • bodytext bodytext bodytext

Convert String to Integer or int in Groovy

String intValStr="10"
int intVal = intValStr as int
Integer intVal1 = intValStr as int
println(intVal+","+intVal1)

String floatValStr="10.1"
float floatVal = floatValStr as float
Float floatVal1 = floatValStr as float
println(floatVal+","+floatVal1)
Be Sociable, Share!
 
Does that help to solve your problem?
VN:F [1.8.5_1061]
Rating: -4 (from 4 votes)
0 votes 'YES'  4 votes 'NO'
TAGS
No tags for this post.
RELATED
Pages
Posts
SOCIAL
Be Sociable, Share!

Leave a Reply