Searching for and Replacing Text in a String

Complete the following steps to search for and replace text in a string.

  1. Select the Search and Replace String function from the Functions»String palette and place it on the block diagram.
  2. Wire the string you want to search to the string input of the Search and Replace String function.
  3. Wire the string you want to search for to the search string input.
  4. Wire the replacement string to the replace string input.
  5. To replace all occurrences of the text, set the replace all input of the Search and Replace String function to TRUE. To replace the first occurrence, set replace all to FALSE.
  6. Wire the result string output of the Search and Replace String function to a string indicator or VI or function that accepts a string as an input.
  7. Run the VI. The offset past replacement output of the Search and Replace String function indicates the point in the string where the first match of the text in replace string was found.