Convert String to Integer or int

By neokrates, written on April 14, 2010

groovy   snippet

Rate it
  • 1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 3 out of 5)
    Loading ... Loading ...
Ad
Poll
  • What are the 3 most important SCM/VCS features for you?

    • Something else (80%, 8 Votes)
    • Simplicity (20%, 2 Votes)
    • Short learning curve (10%, 1 Votes)
    • Open-source (10%, 1 Votes)
    • Speed (10%, 1 Votes)
    • Bug-free (solve code problems, not SCM) (10%, 1 Votes)
    • Distribution (0%, 0 Votes)
    • Established SCM with large community (0%, 0 Votes)
    • Cross-platform (works the same way for many OS's) (0%, 0 Votes)
    • Number of capabilities and commands, more is better (0%, 0 Votes)
    • Centralization (0%, 0 Votes)

    Total Voters: 10

    Vote

    Loading ... Loading ...
Feeds:
  • bodytext bodytext bodytext
Most popular search terms:

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)
 
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
    nope :(
SOCIAL
Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • BlinkList
  • Blogosphere News
  • E-mail this story to a friend!
  • Furl
  • LinkArena
  • Live
  • MisterWong
  • Print this article!
  • StumbleUpon
  • Technorati
  • Webnews.de
  • YahooMyWeb

Leave a Reply