ToInt
public static int ToInt(this string current) { int convertedValue; int.TryParse(current, out convertedValue); return convertedValue; }Example:
var someString = "5"; var someInt = someString.ToInt();
Description
tries to parse a string to an int, returns zero if it is unable to parse
Details
- Author: Sean Biefeld
- Submitted on: 11/10/2010 10:37:04 PM
- Language: C#
- Type: System.String
- Views: 2434
Double click on the code to select all.