Como melhorar a função Substituir na função CLR?
Eu tenho uma função CLR para substituir valores de seqüência de caracteres. mas corre muito tempo. Como posso melhorar essa função e fazer com que ela funcione mais rápido?
public static SqlString ReplaceValues(String Value)
{
// Put your code here
char[] c = new char[] { '.' };
Value= Value.Trim();
Value = Value.Trim(c);
Value = Value.Replace("'", "").Replace(")", " ").Replace("(", " ").Replace("-", " ").Replace("_", " ");
Value = Regex.Replace(Value, @"[י", "+[י");
Value = Regex.Replace(Value, @"\s+", " ");
return new SqlString(Value.Trim());
}
EDIT: eu mudei minha função para usar o valor. Substituir, é melhor, mas ainda corre mais tempo do que o esperado:
public static SqlString ReplaceStreetValues(String Value)
{
// Put your code here
Value = Value.Trim();
char[] c = new char[]{'.'};
Value = Value.Trim(c);
Value= Value.Replace("'", "").Replace(")", " ").Replace("(", " ").Replace("-", " ").Replace("_", " ").Replace("רח", "");
while (Value.IndexOf(" ")!=-1)
Value = Value.Replace(" ", " ");
while (Value.IndexOf("hh") !=-1)
Value = Value.Replace("hh", "h");
return new SqlString(Value.Trim());
}
obrigado!!!