How could i convert data from string to long in C#?
I have data
String strValue[i] ="1100.25";
now i want it in
long l1;
If you want to get the integer part of that number you must first convert it to a floating number then cast to long.
long l1 = (long)Convert.ToDouble("1100.25");
You can use Math
class to round up the number as you like, or just truncate...
You can also use long.TryParse
and long.Parse
.
long l1; l1 = long.Parse("1100.25"); //or long.TryParse("1100.25", out l1);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With