Crimson Len() Function Explanation

20 Oct 2026

The Len(string) function can be used to determine the number of characters in a string, excluding the null character.

 

APPLICABLE PRODUCTS

Crimson 2.0

Crimson 3.0

Crimson 3.1

Crimson 3.2

 

ISSUE / QUESTION / SYMPTOM

How to use the Len(string) function in Crimson programming.

Use Case: To determine if a string of characters match a set known number of characters.

                  String=the string of characters you want to get a character count of. A string tag can be used or                             characters inside quotations ex: ”Test1234”

 

Application: When you scan a barcode/input a long string of characters in a text box.

You can verify if the string of characters matches a set length to know if the barcode is correct or not.

 

Example Programming:

StringLength=Len(String); //This will put an integer number in tag labeled StringLength  

If the tag labeled String=ABCDEFG when this function is run, the number that will show in the StringLength tag is 7.

Using other programming you can compare the StringLength number to a known number to determine if the length is correct.

Example:

StringLength=Len(String);

Bad=0;

Good=0;

if(StringLength==7)

{Good=1;}

else if( StringLength != 7)

{Bad=1;};

 

Explanation:

This function will count the number of characters in the “String” tag and put that integer number in the tag labeled StringLength. In the example programming above it compares the string length to a known number to determine if the length is good or bad.

 

POSSIBLE CAUSES / ANSWER

Using the Len() function you can determine the number of characters in a string or string tag.

 

Need Further assistance? Submit a support ticket here.

https://support.hms-networks.com/

© HMS Networks AB 2026