LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

string length case

Hello,

 

I am trying to create a vi. which returns a greeting after a name (first and last) and gender are input into the program. The result needs to be in the following format "Hello Mr. _Last Name_!" if name is input as male and "Hello Ms._Last Name_!" if the name is input as female. The hard part is making it so that it returns the last name so long as the full last name is less than 8 characters, and returning only the first letter of the last name if the last name is more than 8 letters. Attached is what i have thus far.

 

Not looking for out-right "This is what you have to do" just some guidance.

0 Kudos
Message 1 of 5
(2,768 Views)

Now you have the length of the last name, do a comparison operation to determine if it is shorter or longer than your target length and use that to drive a case structure that uses the last name or just the first letter of the last name.

0 Kudos
Message 2 of 5
(2,764 Views)

Ok so here is where im at. got a little stuck trying to get the same output as opposed to have two string indicaters on the front panel. Is there a work around for this?

0 Kudos
Message 3 of 5
(2,753 Views)

First, I would recommend looking at the online LabVIEW tutorials so you can get a better idea how LabVIEW works.
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

 

Have one case structure that determines whether the string constant is a Mr. or Mrs.

 

Then feed the result of that to the next case structure where the condition is the string length.  One case has the initial, the other case the full last name.

 

The output of that goes to the indicator.

0 Kudos
Message 4 of 5
(2,741 Views)