Documentation
¶
Overview ¶
Package filepaths -- path/filepath パッケージに関するサンプルが配置されているパッケージです。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Clean ¶ added in v0.5.44
func Clean() error
Clean は、filepath.Clean のサンプルです。
filepath.Clean は、パス文字列を「意味は同じだけど最短の形」に正規化するだけの関数です。 ファイルシステムは一切見ず、純粋に文字列処理だけを行います。
filepath.Clean はざっくり以下のことをしてくれる。
連続するセパレータを 1 個にする
カレント(".")を消す
パスの途中の .. を解決して、直前の要素とセットで消す
絶対パスの先頭の /.. を / に変える(ルートより上には行かせない)
REFERENCES ¶
func ExcludeSuffix ¶ added in v0.5.34
func ExcludeSuffix() error
ExcludeSuffix は、ファイル名から拡張子を除いた値を取得するサンプルです.
filepath.Ext()とstrings.TrimSuffix()を組み合わせて取得出来ます。
> strings.TrimSuffix(file, filepath.Ext(file))
または、スライスを拡張子分だけカットすることでも取得出来ます。
> file[:len(file)-len(filepath.Ext(file))]
REFERENCES ¶
func NewRegister ¶
NewRegister -- このパッケージ用のサンプルを登録する mapping.Register を生成します。
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.