using System;
using System.Collections.Generic;
using System.Globalization;
public class StringHelper
{
public static int IndexOfWithCaseAndAccentInsensitive (string source, string stringToSearch)
{
CompareInfo ci = new CultureInfo("en-US").CompareInfo;
CompareOptions co = CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace;
return ci.IndexOf(source, stringToSearch, co);
}
public static void Main()
{
RL();
WL(IndexOfWithCaseAndAccentuationIncensite("zzzzzzzzzzzÁbc", "a"));
RL();
}
#region Helper methods
private static void WL(object text, params object[] args)
{
Console.WriteLine(text.ToString(), args);
}
private static void RL()
{
Console.ReadLine();
}
private static void Break()
{
System.Diagnostics.Debugger.Break();
}
#endregion
}
Obrigado João, pode vir a ser útil.
Subscribe to:
Post Comments (Atom)
2 comments:
Me ajudou muito.
Thanks.
grande achado :D
Post a Comment