- Path("file").withStem("readme") → "readme"
- Path(".env.local").withStem("config") → "config.local"
- Path(".bashrc").withStem("profile") → "profile"
Parameters
newStem | The new stem (must be non-empty). It is treated as a literal fragment and may contain dots. No filesystem checks are performed. |
Returns
A new Path with its final component's stem replaced by
newStem.Throws
If
newStem is empty.