#develop (short for SharpDevelop) is a free IDE for .NET programming languages.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

50 lines
1.1 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using System.Collections;
namespace SharpDevelop.XamlDesigner
{
public static class Utils
{
public static string DoubleToInvariantString(double d)
{
return d.ToString(NumberFormatInfo.InvariantInfo);
}
public static bool TryParseDouble(string s, out double result)
{
if (!double.TryParse(s, NumberStyles.Float | NumberStyles.AllowThousands,
NumberFormatInfo.CurrentInfo, out result)) {
if (!double.TryParse(s, NumberStyles.Float | NumberStyles.AllowThousands,
NumberFormatInfo.InvariantInfo, out result)) {
return false;
}
}
return true;
}
public static bool CamelFilter(string name, string filter)
{
if (string.IsNullOrEmpty(filter)) {
return true;
}
for (int i = 0; i < name.Length; i++) {
if (i == 0 || char.IsUpper(name[i])) {
if (string.Compare(name, i, filter, 0, filter.Length, true) == 0) {
return true;
}
}
}
return false;
}
public static bool IsCollection(Type type)
{
return typeof(IList).IsAssignableFrom(type);
}
}
}