Example Code

How to Search an Array of Strings 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

 Overview

This VI relates to how to programmatically search a string in an array of strings.

 

 Description

You can use this VI to search the first element of a string array that contains a specific substring. You can also choose to make that search case insensitive. This VI is composed by a conditional for loop that contains "match regular expression" and the exit condition is if the match regular expression function detect a substring, after that there is a case structure that manage the element not found case or show the element that contains the substring. 

 

 Requirements

  • LabVIEW 2012 (or compatible)

 

 Steps to Implement or Execute Code

  1. Open the VI
  2. Insert a string array
  3. Insert the string to search for
  4. Run the VI
  5. Pulse Ignore case to do a case insensitive search

 

Additional Information or References
VI Block Diagram

Search string in an Array LV2012 NI verified.png

 

 

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

 

Many thanks for using the NI forums and I look forward to your reply.

Kind regards

David

Applications Engineer
National Instruments UK

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