C#-#TIP에서 확장자 없는 파일 이름 가져오기
걱정 마세요.
System.IO.Path
에는 이런 상황을 전문적으로 겨냥한 방법이 있다.using System.IO;
///
/// Get file name without extension
///
static string GetFileName(string path)
{
return Path.GetFileNameWithoutExtension(path);
}
///
/// Get file name without extension
///
static string GetFileName(FileInfo fileInfo)
{
return Path.GetFileNameWithoutExtension(fileInfo.Name);
}
이 답안은 Stack Overflow 포럼에서 인정받았다.Getting file names without extensions
Reference
이 문제에 관하여(C#-#TIP에서 확장자 없는 파일 이름 가져오기), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/rmaurodev/title-getting-the-file-name-without-extension-in-c-tip-49hl텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)