hyTags
HomeHome DocumentationDocumentation

string-remove-suffix

Removes the suffix from a string if it matches.
Parameter
Type
Description
self
String
String to remove characters from
suffix
String
Suffix to remove
return
string
String with the suffix removed, or unchanged if suffix doesn't match
Test Case:Remove matching suffix
    <div></div>
    
    <string-new value="hello.txt">
    <string-remove-suffix suffix=".txt">
    <assert-equal value="hello" type="string">
    
    👆 Try to change something!
  • Test Case:Non-matching suffix returns unchanged
      <div></div>
      
      <string-new value="hello.txt">
      <string-remove-suffix suffix=".md">
      <assert-equal value="hello.txt" type="string">
      
      👆 Try to change something!
    • Test succeeded Test failed