Skip to content

Modern Fs PathChangeExtension

Paul Squires edited this page Oct 19, 2026 · 5 revisions

Home › Filesystem › Filesystem Library › PathChangeExtension

PathChangeExtension

Replaces a path's extension, or removes it when the new one is empty.

Syntax

PathChangeExtension( p, ext )

Notes

  • ext with or without its dot; "" removes

Examples

#import "std/fs"
using fs

print PathChangeExtension( "main.tiko", ".o" )       '' main.o

'' The dot is optional in the argument -- both forms mean the same
print PathChangeExtension( "main.tiko", "o" )        '' main.o

'' An EMPTY extension REMOVES it
print PathChangeExtension( "main.tiko", "" )         '' main

'' A file with no extension gains one
print PathChangeExtension( "README", ".md" )        '' README.md

Library: Filesystem Library
Category: Filesystem
Documented under: Paths

Clone this wiki locally