LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

search and split the string

N00001D2312T140402N00002D2312T140403N00003D2312T140403N00004D2312T140404N00005D2312T140404N00006D2312T140404N00007D2312T140405N00008D2312T140405N00009D2312T140405

 

i have this data i want to split it to 72 character  and put a end line

 some thing like this below:

 

N00001D2312T140402N00002D2312T140403N00003D2312T140403N00004D2312T140404

N00005D2312T140404N00006D2312T140404N00007D2312T140405N00008D2312T140405

N00009D2312T140405

 

currently i just have few data if in future i will have much... plz help. thk u

0 Kudos
Message 1 of 22
(9,401 Views)

a. Create a while loop. 

b. Find the string length and use that number for number of iteration that you need.

c.Use String Subset to break the string into parts,

d. use carriage return or line feed constant in the string palette and concatenate with the string subset using concatenate string vi again in the string palette.

0 Kudos
Message 2 of 22
(9,398 Views)
thks but i still confuse , can i get an example for this plz...thk u
0 Kudos
Message 3 of 22
(9,390 Views)

Hi Jeyanthi,

 

There is a number of way to do that. I have attached one possible way. I hope it helps.

 

Aman 

 

Message Edited by aman_bajra on 12-26-2008 11:34 PM
0 Kudos
Message 4 of 22
(9,386 Views)

aman_bajra, there is a problem with your proposed solution : the resulting string contains only the last chunk of data, with a probably unwanted terminal CR.

You need to test the length of the splited string before adding or not a CR, and concatenate the string using a shift register...


Message Edité par chilly charly le 12-27-2008 04:02 PM
Chilly Charly    (aka CC)

         E-List Master - Kudos glutton - Press the yellow button on the left...
        
0 Kudos
Message 5 of 22
(9,353 Views)

Hi

i have one similar problem. i explain : i have for example some string like that

 

"<pays> Finland </pays> <ville> Tampere </ville> <temperature> 17~C </temperature> <ensoleillement> Nuageux </ensoleillement>" (xml code).

 

And i want my programme just give me:

 

" Finland Tampere 17~C Nuageux ".

 

In the qim to published it.

I used some cluster for my string some for loops but i haven´t succeeded.

An other problem is i don´t know all the time when i have to split, the lengh of the string is variable so i can´t do as you do. I mean to split all the 72 char for example. I tried many thing but i really have great difficulty to do that. I have really not anymore ideas how to do that.

So please help me i am becoming crazy because of that one.

 

PLEEEEEEEEEEEEEEEEEEASE 🙂

thank you so much

BaccAdr

 

Sorry for my english i am a french student on a finnish keyboard Smiley Mad

0 Kudos
Message 6 of 22
(8,198 Views)

Hi Bacc Adr,

 

Check the attached VI. I think it will solve your problem..


Regards,

Nitzz

 

(Kudos are always Welcome;))

Message 7 of 22
(8,185 Views)

Hi Nittz,

 

Your code could be simplified using Regular Expressions as shown below:  (bottom code)

 

The solution is more flexible as it does not hard code how many tags to remove.

 

0 Kudos
Message 8 of 22
(8,178 Views)

I found out I had a Rube Goldberg of my own!!!

 

RG SearchReplace.png

 

Thanks to Darin for the improvement.  Amazing what can be done with a boolean 😉

LOL!

Message 9 of 22
(8,150 Views)

Hi both of you,

 

This is almost perfect and you are (almost) both god for me, I will analyze precisely that soon ( but Ray R i did not have time to use you because at home i have only LV 7.1). But small problem wich stay with the first big, it´s i said

"<pays> Finland </pays> <ville> Tampere </ville> <temperature> 17~C </temperature> <ensoleillement>Nuageux  </ensoleillement>"

 

just as example but it could be totally random, so the data could be longer as

"<pays> Finland </pays> <ville> Tampere </ville> <temperature> 17~C </temperature> <ensoleillement> Nuageux  </ensoleillement> <date>5 mai </date> <time> 3:00 pm </time>"

 

or shorter.

But don´t worry I will try to find a solution and if i have a HUGE problem I would come back to you.

I don´t know if you just come to make this one but it´s really impressive. The function you used are well concatenate string & match pattern ?

 

THAAAAAAAAAAAAAAAAAAAAN YOUUUUUUUUUHOUUUUUUUUU so much Smiley Happy

Best regards

BaccAdr

 

0 Kudos
Message 10 of 22
(8,139 Views)