Skip to content

Commit f30a6fc

Browse files
committed
feat: add conversion method
1 parent 5944a9c commit f30a6fc

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

style.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package universalpath
22

33
import (
4+
"strings"
5+
46
"github.com/NextronSystems/universalpath/unix"
57
"github.com/NextronSystems/universalpath/windows"
68
)
@@ -83,3 +85,10 @@ func (p Style) IsAbs(s string) bool {
8385
return windows.IsAbs(s)
8486
}
8587
}
88+
89+
func (p Style) To(other Style, s string) string {
90+
if p == other {
91+
return s
92+
}
93+
return strings.ReplaceAll(s, p.Separator(), other.Separator())
94+
}

0 commit comments

Comments
 (0)