The Daily CLAD

Community Browser
cancel
Showing results for 
Search instead for 
Did you mean: 

Re: CLAD2017 - Friday Mind Bender - Parse that string

SercoSteveB
Active Participant

What are the contents of Parsed Array Out following execution of the VI?

 

Friday Mind Bender.png

 

Work through the VI yourself or expand the Spoiler tag to see the possible answers.

 

Spoiler
Friday Mind Bender Answers.png 
Comments
PakAsia
Member

b

timmy
monesh
Member

b

GladysToMeetYou
Member

B

SravanKumarAtla
Member

B is the ans.....!!

Sravankumar Atla
CLD || CTD
A_rid
Member

B

Baltur
Member

B)

A few things to watch out for here:

1. The 'delimiter' constant label is a trap. It's a search string and it works different from the 'delimiter' inputs of e.g. the spreadsheet string functions.

2. Search/Split String has as outputs the substring before the match (AB), and the substring MATCH+substring after match (C), and the offset of the match. This is different from the Match Pattern/Regular Expression functions which split the string into substrings before match, match and after match and output the offset AFTER match.

3. Notice the empty elements at the end of the Arrays.

crossrulz
Knight of NI

B


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Ellie90
Member

The answer is B.

However, I have a question about the results of "offset of match" output when I run the vi myself.

 

In the first run, input string = "Steve,Likes,LabVIEW"; offset input = 0; offset of match = 5, which indicates the position of the first comma and makes sense.

 

In the second run, input string = ",Likes,LabVIEW"; offset input = 6; offset of match = 7 which I couldn't understand because it looks like the position index of the second comma should be still 6

 

Does anybody have any clue on that?

crossrulz
Knight of NI

Ellie90, I am getting {5, 6, -1, -1} when I run it.  You probably have a space in your initial input string constant after the commas or some extra character of some sort.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Ellie90
Member

crossrulz, I double checked and yes you are right. I have a space after each comma by habit. Silly mistake. Thank you for answering it!

qubirt
Member

B

Tsjabrantes
Member

 

Hello everyone!

 

Nice exercise SercoSteveB...

After reading Search/Split String help context I could understand the output result of the exercise.

So, the correct answer is letter B...

Thanks and see you soon!

Smiley Very Happy

Tarciso Junior
+55 (11) 996-282-103
Skype: Tarciso.junior2
Email: Tsjabrantes@gmail.com
http://br.linkedin.com/pub/tarciso-junior/23/a83/463
Priya16
Member

Steve,Likes,LabVIEW in that answer is B. But offset past match is initially 5 & finally -1 logically I can understand my doubt is middle values 6,-1. I can't understand logically.  Can anyone tell the logic behind this 5,6,-1,-1?

crossrulz
Knight of NI

Look at what is in the string shift register after each iteration.  The Search/Split String is removing everything before the found comma.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
CataM
NI Employee (retired)

b)

Priya16
Member

Thanks for clarifying my doubt... But I got an confusion in this string slow,and,steady,wins,the,race I got an offset of match values are 4,4,6,9,-1,-1 in that I unwired the iteration terminal & +1 increment. I connected offset of match value as it is & connected to shift register. My confusion is why I am getting 9 instead of 5 & 4 (,wins,the,) help me, find out the logic behind 9.search or split string (1).jpg

 

crossrulz
Knight of NI

The offset input tells the Search/Split/String where to start looking for the search string.  So in your example, you have ",wins,the,race" with an offset of 6 (passed from the previous iteration).  Therefore, the comma will be searched for starting at the 't' in "the".  The next comma after that is in position 9.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Priya16
Member

Thank you so much...cleared all my doubts...Smiley Happy


 

sankar06
Member

B

Happy to Wire
MAX_2019
Member

la risposta é B

 

SercoSteveB
Active Participant

Answer: B.  Nice one all. 

 

LabVIEW 2017 Help for the Search/Split String function.

rak84
Member

B

istan0227
Member

B