2
C#의 새로운 기능입니다. 나는 파일 및 디렉토리 이름을 변경하기위한 프로그램을 작성하려고한다.C# regex를 사용하여 파일 및 디렉토리 이름을 변경하는 방법
public static string ToUrlSlug(this string text)
{
return Regex.Replace(
Regex.Replace(
Regex.Replace(
text.Trim().ToLower()
.Replace("ö", "o")
.Replace("ç", "c")
.Replace("ş", "s")
.Replace("ı", "i")
.Replace("ğ", "g")
.Replace("ü", "u"),
@"\s+", " "), //multiple spaces to one space
@"\s", "-"), //spaces to hypens
@"[^a-z0-9\s-]", ""); //removing invalid chars
}
경로 C:\Users\dell\Desktop\abc
으로 작업하고 싶습니다. 프로그램에이 경로를 추가하려면 어떻게해야합니까?