LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

remove element containing certain pattern from string array

My question sounds rather simple, but I can't find a good solution:
 
I have a 1-dim array of strings and want to remove all elemets that contain a certain pattern (e.g. %xxx%).
 
I dont' find a suitable function, neither at strings nor at arrays.
 
Thanks in advance,
 
         Magnus
0 Kudos
Message 1 of 4
(3,461 Views)
Hello Magnus,

use a FOR loop with autoindexing, check the single string and add it to an array, if it should not be removed...

Message Edited by GerdW on 05-05-2006 10:06 AM

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(3,458 Views)
Thanks, it works Smiley Very Happy
0 Kudos
Message 3 of 4
(3,451 Views)
Hello Magnus,

one thing to keep an eye on:
for big arrays this method is ineffective regarding memory consumption! Then it would be better to feed the shift register with an initialized array of strings and replace the entries.  After the loop you make the array smaller (take subarray) by the amount of not needed entries. And it would be better when all strings have the same length...

Just query the forum on "memory consumption of big arrays"!

P.S.: Thank me by rating 🙂

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 4
(3,447 Views)