fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 150: Remove trailing slash
Idiom # 150: Remove trailing slash
See
programming-idioms.org
:
Code
p := if p.ends_with "/" then p.substring 0 p.byte_length-1 else p
What are effects?
Running Example
ex150 is p := "path/" p1 := if p.ends_with "/" then p.substring 0 p.byte_length-1 else p say p1
What are effects?
last changed: 2024-07-01
next: NYI: Idiom # 151: Remove string trailing path separator