Returning the length of a stringΒΆ

strlen()

Return the length of a string


SYNTAX

strlen(text_expression)

Returns the length of the string text_expression with trailing spaces excluded.

If text_expression contains no data, then the function returns 0.

This function returns an integer in the range 0-255, which may be stored in a u1 field.


EXAMPLE

  1. Sets Stringlen to 29:

    !temp StringLen,,i1,##
    !temp Text,,a30
    
         tmp.Text = " HOW LONG IS A PIECE OF STRING   "
         tmp.Stringlen = strlen(tmp.Text)
    
  2. EndsWith() function:

    !function EndsWith(Source, Pattern) {
    
         if (getstr(Source,(strlen(Source) - strlen(Pattern)) + 1, strlen(Pattern)) = Pattern) \
              then return TRUE else return FALSE
    }
    

RELATED TOPICS

String handling functions