ファイル名を取得する

このTipsについて

フルパスを使用してファイル名を取得する。

サンプル


  • ファイル名を取得する。
  1. Dim FilePath = "C:\test.txt"
  2. Console.WriteLine(IO.Path.GetFileName(FilePath))
  3. '結果:「test.txt」
  4.  

  • 拡張子を除いたファイル名を取得する。
  1. Dim FilePath = "C:\test.txt"
  2. Console.WriteLine(IO.Path.GetFileNameWithoutExtension(FilePath))
  3. '結果:「test」
  4.  

タグ:

Tips
+ タグ編集
  • タグ:
  • Tips

このサイトはreCAPTCHAによって保護されており、Googleの プライバシーポリシー利用規約 が適用されます。

最終更新:2011年12月26日 12:06