|
// retoor <retoor@molodetz.nl>
|
|
|
|
import "pathlib" for Path
|
|
|
|
var p1 = Path.new("/home/user/file.tar.gz")
|
|
System.print(p1.name) // expect: file.tar.gz
|
|
System.print(p1.stem) // expect: file.tar
|
|
System.print(p1.suffix) // expect: .gz
|
|
System.print(p1.suffixes) // expect: [.tar, .gz]
|
|
|
|
var p2 = Path.new("/home/user/file.txt")
|
|
System.print(p2.name) // expect: file.txt
|
|
System.print(p2.stem) // expect: file
|
|
System.print(p2.suffix) // expect: .txt
|
|
System.print(p2.suffixes) // expect: [.txt]
|
|
|
|
var p3 = Path.new("/home/user/noext")
|
|
System.print(p3.name) // expect: noext
|
|
System.print(p3.stem) // expect: noext
|
|
System.print(p3.suffix) // expect:
|
|
System.print(p3.suffixes) // expect: []
|
|
|
|
var p4 = Path.new("/home/user/.hidden")
|
|
System.print(p4.name) // expect: .hidden
|
|
System.print(p4.stem) // expect: .hidden
|
|
System.print(p4.suffix) // expect:
|
|
System.print(p4.suffixes) // expect: []
|