Examples of $LENGTH()

Example:

    GTM> WRITE $LENGTH("KINGSTON")
    8
    GTM>
    

This uses $LENGTH() to WRITE the length in characters of the string "KINGSTON".

Example:

    GTM> SET x="Smith/John/M/124 Main Street/Ourtown/KA/USA"
    7
    GTM>
    

This uses $LENGTH() to WRITE the number of pieces in a string, as delimited by /.

Example:

    GTM> WRITE $LENGTH("/2/3/","/")
    4
    GTM>
    

This also uses $LENGTH() to WRITE the number of pieces in a string, as delimited by /. Notice that GT.M. adds one count to the final number of pieces (in this case 3), in the string (displays 4).