Here are the examples of the csharp api string.TrimNumbers(bool) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
4 Examples
19
Source : ExtensionMethods.cs
with MIT License
from n00mkrad
with MIT License
from n00mkrad
public static int GetInt(this string str)
{
if (str.Length < 1 || str == null)
return 0;
try
{
return int.Parse(str.TrimNumbers());
}
catch (Exception e)
{
Logger.Log("Failed to parse \"" + str + "\" to int: " + e.Message);
return 0;
}
}
19
Source : ExtensionMethods.cs
with MIT License
from n00mkrad
with MIT License
from n00mkrad
public static float GetFloat(this string str)
{
if (str.Length < 1 || str == null)
return 0f;
string num = str.TrimNumbers(true).Replace(",", ".");
float value;
float.TryParse(num, NumberStyles.Any, CultureInfo.InvariantCulture, out value);
return value;
}
19
Source : ExtensionMethods.cs
with GNU General Public License v3.0
from n00mkrad
with GNU General Public License v3.0
from n00mkrad
public static int GetInt(this string str)
{
if (str.Length < 1 || str == null)
return 0;
try
{
return int.Parse(str.TrimNumbers());
}
catch (Exception e)
{
Logger.Log("Failed to parse \"" + str + "\" to int: " + e.Message, true);
return 0;
}
}
19
Source : ExtensionMethods.cs
with GNU General Public License v3.0
from n00mkrad
with GNU General Public License v3.0
from n00mkrad
public static float GetFloat(this string str)
{
if (str.Length < 1 || str == null)
return 0f;
string num = str.TrimNumbers(true).Replace(",", ".");
float value;
float.TryParse(num, NumberStyles.Any, CultureInfo.InvariantCulture, out value);
return value;
}