LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

split string to the required pattern

Solved!
Go to solution

Hi guys, 

I have an array of input string for example "P?\.?" I need to split it into an array as 

index 0=P 

index 1=?   

index 2=\. 

index 3=?

 

(I.e if its a "?" I have to store it in a different index and if its "\." I have to store in a different index.

Please help me with this?

also attached and vi which I'm working on.

 

0 Kudos
Message 1 of 8
(2,074 Views)

Was about to say that this is insanely easy, then noticed the dot after the backslash. Give us a couple other example strings and expected outputs.

 

What if the input string is "P?/.?" (forward slash)? What if it's "P?.\.?" (extra dot)?

 

I'm working in 2017 so I can't open your VI unfortunately.

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 2 of 8
(2,043 Views)

Thanks for the reply.

there won't be any forward slashes.

 

below are few examples of the string

P?\.?

REL?\.?\.?

P??\.?

(i.e  "\." are always together and with the same order and same type.)

 

0 Kudos
Message 3 of 8
(2,036 Views)

@tars364 wrote:

Thanks for the reply.

there won't be any forward slashes.

 

below are few examples of the string

P?\.?

REL?\.?\.?

P??\.?

(i.e  "\." are always together and with the same order and same type.)

 


What are the expected outputs of those examples?

 

I'm gonna guess:

"REL?\.?\.?" --> [R, E, L, ?, \., ?, \., ?]

"P??\.?" --> [P, ?, ?, \., ?]

 

That right?

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 4 of 8
(2,017 Views)

Yes it is right.

but I want keep the starting string combined in the first index.

i.e (REL?\.?\.?)   =>>> OUTPUT ==>>(REL, ?,\.,?,\.,?) 

0 Kudos
Message 5 of 8
(2,014 Views)

Yes, could you help with this?

0 Kudos
Message 6 of 8
(1,995 Views)
Solution
Accepted by topic author tars364

Lot of different ways to do this but this is the first that came to mind.

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

Message 7 of 8
(1,988 Views)

Thank you

0 Kudos
Message 8 of 8
(1,984 Views)