stdlib/os/path.codon

pull/13/head
Ishak Numanagić 2022-01-24 11:02:49 +01:00
parent 808e932685
commit 928d2a0c56
1 changed files with 6 additions and 3 deletions

View File

@ -1,10 +1,13 @@
# (c) 2022 Exaloop Inc. All rights reserved.
def splitext(p: str) -> Tuple[str, str]: def splitext(p: str) -> Tuple[str, str]:
""" """
Split the extension from a pathname. Split the extension from a pathname.
Extension is everything from the last dot to the end, ignoring Extension is everything from the last dot to the end, ignoring
leading dots. Returns "(root, ext)"; ext may be empty.""" leading dots. Returns "(root, ext)"; ext may be empty."""
sep = '/' sep = "/"
extsep = '.' extsep = "."
sepIndex = p.rfind(sep) sepIndex = p.rfind(sep)
dotIndex = p.rfind(extsep) dotIndex = p.rfind(extsep)