るりまサーチ

最速Rubyリファレンスマニュアル検索!
108件ヒット [101-108件を表示] (0.136秒)

別のキーワード

  1. pathname basename
  2. file basename
  3. _builtin basename
  4. shell basename
  5. filter basename

ライブラリ

クラス

キーワード

検索結果

<< < 1 2 >>

File.extname(filename) -> String (7.0)

ファイル名 filename の拡張子部分(最後の "." に続く文字列)を 返します。ディレクトリ名に含まれる "." や、ファイル名先頭の "." は拡張子の一部としては見なされません。filename に拡張子が含 まれない場合は空文字列を返します。

...tar.gz") # => ".gz"
p File.extname("foo/bar") # => ""
p File.extname("foo/.bar") # => ""
p File.extname("foo.txt/bar") # => ""
p File.extname(".foo") # => ""
//}

@param filename ファイル名を表す文字列を指定します。

@see File.basename, File.dirname...
...") # => ""
p File.extname(".foo") # => ""

# Windows の場合
p File.extname("foo.") # => ""
# Windows 以外の場合
p File.extname("foo.") # => "."
//}

@param filename ファイル名を表す文字列を指定します。

@see File.basename, File.dirname...
<< < 1 2 >>