From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Set String Length using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Description

1. Overview:

This VI will keep the output string length to Max String Length input by truncating the string to the selected length

 

2. Description: 

This VI is meant to be used as a subVI.  It was originally used in a streaming application with shift registers.  In order to keep the memory usage from running away with a large string, this VI can be used to cap the overall length (and required memory).

 

3. Requirements

  • LabVIEW 2012 (or compatible)

4. Steps to Implement or Execute Code

  1. Use this VI as subVI
  2. Provide String Input and Max String Length Parameters from the calling VI
  3. If the input string length is shorter than the Max String Length parameter the result string will be the same. If it is larger, the result string will be truncated to the Max String Length.

5. Additional Information or References 

 VI Snippet 

Set String Limit SubVI - LV 2012 NI Verified.png

 

**This document has been updated to meet the current required format for the NI Code Exchange.** 

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors