Vala. How to Convert String to Long

This Vala snippet shows how to convert a string to long. To convert from String to long integer in Vala use the long.parse() method.

long number = long.parse("123");
Warning. The to_long() method used in previous versions of Vala is deprecated and will result in warning:
string string_number = "123";
long number = str_number.to_long();
warning: string.to_long is deprecated. Use long.parse