flang.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/" p := if p.ends_with "/" then p.substring 0 p.byte_length-1 else p say p
What are effects?
next: NYI: Idiom # 151: Remove string trailing path separator