OxL Reference

method Path.withExtension

The path with its extension replaced by ext (added when there is none).

Example:

oxl✓ checked in CI
use std.io { Path }

fn main() io {
  print(Path.of("a/main.oxl").withExtension("o").text)
}
Output
a/main.o
pub(api) fn withExtension(ext: str) -> Path

Since. 1.0.0-beta

Parameters

NameType
extstr

Returns

Path

Effects

none declared (pure unless the body says otherwise)

Defined in: std/io/io.oxl:976

See also