Estoy tratando de traducir el siguiente método slugify desde PHP a C#: http://snipplr.com/view/22741/slugify-a-string-in-php/slugify y transliteración de caracteres en C#
Editar: Por razones de conveniencia, aquí el código de arriba:
/**
* Modifies a string to remove al non ASCII characters and spaces.
*/
static public function slugify($text)
{
// replace non letter or digits by -
$text = preg_replace('~[^\\pL\d]+~u', '-', $text);
// trim
$text = trim($text, '-');
// transliterate
if (function_exists('iconv'))
{
$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
}
// lowercase
$text = strtolower($text);
// remove unwanted characters
$text = preg_replace('~[^-\w]+~', '', $text);
if (empty($text))
{
return 'n-a';
}
return $text;
}
no tengo probleming el resto de codificación excepto que no puedo encontrar el equivalente C# de la siguiente línea de código PHP:
$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
Editar: propósito de esto es traducir los caracteres no ASCII como Reformáció Genfi Emlékműve Előtt
en reformacio-genfi-emlekmuve-elott
¿Te importa publicar la solución final para poder verla? – chakrit