hyTags
HomeHome DocumentationDocumentation

string-get-prefix

Gets the first N characters of a string.
Parameter
Type
Description
self
String
String to get prefix from
length
Number
Number of characters to extract
return
string
String containing the first N characters
Test Case:Get first 5 characters
    <div></div>
    
    <string-new value="hello world">
    <string-get-prefix length="5">
    <assert-equal value="hello" type="string">
    
    👆 Try to change something!
  • Test Case:Get prefix longer than string returns full string
      <div></div>
      
      <string-new value="hi">
      <string-get-prefix length="10">
      <assert-equal value="hi" type="string">
      
      👆 Try to change something!
    • Test succeeded Test failed