I couldn’t live without “String to 1D Array” and “1D Array to String”

Posted on Saturday 31 March 2007

This is the third article of “The OpenG VIs that I couldn’t live without“, a series of articles showing some of my favorite OpenG VIs. In this article, I’m going to show a couple really great functions: “String to 1D Array” and “1D Array to String“. These two little VIs are used to convert between a string and a 1D array of strings based on a delimiter (see wikipedia definition of “delimiter”) that you specify. Let’s take a look at a simple example of these VIs in action.

Let’s say that we start with a string “one, two, three, four” and we want to extract each of the words that are separated (delimited) using a comma followed by a space character (“, “). We can use “String to 1D Array” to convert our input string into an 1D array, containing the words as elements, as shown below.

String to 1D Array

If we want to convert our array of strings into a single string with a delimiter to separate each of the elements in the input 1D array of string, we can use “1D Array to String” to accomplish this task, as shown below.

1D Array to String

You’ll certainly find lots of uses for these two VIs, as you’re programming your applications. The above examples are just a simple glimpse of the basic functionality.

If you want to give these VIs a try, you can obtain them using VI Package Manager (VIPM). Simply select the OpenG String Library (the oglib_string package from within VIPM), you will find the OpenG String Tools palette in the Functions palette under the OpenG submenu. (See here for a quick guide on how to install OpenG on VIPM.)

3 Comments for 'I couldn’t live without “String to 1D Array” and “1D Array to String”'

    February 9, 2009 | 5:27 pm

    i want download this vi

    February 9, 2009 | 5:31 pm

    curben: To download this VI, you should follow the instructions in the last paragraph of the my article.

    March 26, 2010 | 12:51 am

    looks fine~~

Leave a comment



Information for comment users
Line and paragraph breaks are implemented automatically. Your e-mail address is never displayed. Please consider what you're posting.

Use the buttons below to customise your comment.

RSS feed for comments on this post |


Bad Behavior has blocked 775 access attempts in the last 7 days.