Reputation: 167
I want to use the string representation of a Long to create a Long of this value
val strLong:String = "0xFF007A45"
And I want a Long with this value
val LongIWant:Long = 0xFF007A45
I tried toLong(), as Long and many other way, but none of them works
Is it possible ?
Regards
Upvotes: 0
Views: 165
Reputation: 7882
val strLong: String = "0xFF007A45"
val longYouWant: Long = strLong.substringAfter("0x").toLong(radix = 16)
Upvotes: 3