¿Cómo mejorar la función Reemplazar en la función CLR?
Tengo una función CLR para reemplazar los valores de cadena. pero se ejecuta mucho tiempo. ¿Cómo puedo mejorar esta función y hacerla correr más 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());
}
EDITAR: Cambié mi función para usar valor. Reemplazar, es mejor, pero aún así se ejecuta más tiempo del 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());
}
¡¡¡Gracias!!!