Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Search for " in Strings

 [1/16] from: moeller_thorsten:gmx at: 16-Aug-2000 14:16


Hi List, I need to search for " in lines of a file to remove them, but i dont know to do that. All other characters are no problem, but """ wont work. Everything i tried ends up in an Invalid String failure. Any suggestions will be gratefully accepted. Thorsten

 [2/16] from: bhandley::zip::com::au at: 16-Aug-2000 22:24


The following is a literal string that contains two double quotes
>> print {He said "hi".}
He said "hi". HTH Brett.

 [3/16] from: allen:rebolforces at: 16-Aug-2000 22:37


----- Original Message ----- From: <[moeller_thorsten--gmx--de]> To: <[list--rebol--com]> Sent: Wednesday, August 16, 2000 10:16 PM Subject: [REBOL] Search for " in Strings
> Hi List, > > I need to search for " in lines of a file to remove them, but i dont know
to
> do that. All other characters are no problem, but """ wont work.
Everything
> i tried ends up in an Invalid String failure. > Any suggestions will be gratefully accepted.
Try using {"} Allen K

 [4/16] from: ralph:abooks at: 16-Aug-2000 8:51


>The following is a literal string that contains two double quotes > > >> print {He said "hi".} > He said "hi". >
<g>Well, to be grammatically correct, it should be:
>> print {He said "hi."}
He said "hi." Sorry, can't resist a correction. As an author, editor, and publisher AND programmer, this is one of my pet peeves. Punctuation goes inside the quote. Syntax counts in English as well as REBOL. --Ralph

 [5/16] from: moeller_thorsten:gmx at: 16-Aug-2000 15:11


Hi Brett, that was not was i was searching for. Perhaps i should be more detailed. i got a file with lines like this: 2;"615165151";"L";20.15;9999456 what i need is a way to get rid of the quotes including informations. the result should look like this 2;615165151;L;20.15;9999456 Hope you can help. Thorsten -----Ursprüngliche Nachricht----- Von: [bhandley--zip--com--au] [mailto:[bhandley--zip--com--au]] Gesendet: Mittwoch, 16. August 2000 14:24 An: [list--rebol--com] Betreff: [REBOL] Search for " in Strings Re: The following is a literal string that contains two double quotes
>> print {He said "hi".}
He said "hi". HTH Brett.

 [6/16] from: bhandley:zip:au at: 16-Aug-2000 23:10



 [7/16] from: bhandley:zip:au at: 16-Aug-2000 23:23


Well I suppose he should have said "Hi." too, rather than his more meek version. ;) Anyway, I'm starting to develop a complex here, this is the second grammatically focussed peeved response I've provoked with my mails. :) I'm certainly learning a few things about English. As for pet peeves, what really peeves me, is poor eating habits. Um, on second thoughts, better not get into that... Brett.

 [8/16] from: allen:rebolforces at: 16-Aug-2000 23:30


----- Original Message ----- From: <[moeller_thorsten--gmx--de]> To: <[list--rebol--com]> Sent: Wednesday, August 16, 2000 11:11 PM Subject: [REBOL] AW: Search for " in Strings Re:
> Hi Brett, > that was not was i was searching for. Perhaps i should be more detailed.
<<quoted lines omitted: 3>>
> result should look like this > 2;615165151;L;20.15;9999456
data: {2;"615165151";"L";20.15;9999456} == {2;"615165151";"L";20.15;9999456}
>> >> replace/all data {"} ""
== "2;615165151;L;20.15;9999456" Allen K

 [9/16] from: bhandley:zip:au at: 16-Aug-2000 23:29


I'm not sure what you meant by "informations" but is something like this what you want?
>> replace/all {2;"615165151";"L";20.15;9999456} {"} ""
== "2;615165151;L;20.15;9999456" Brett.

 [10/16] from: allen:rebolforces at: 16-Aug-2000 23:32


----- Original Message ----- From: <[moeller_thorsten--gmx--de]> To: <[list--rebol--com]> Sent: Wednesday, August 16, 2000 11:11 PM Subject: [REBOL] AW: Search for " in Strings Re:
> Hi Brett, > that was not was i was searching for. Perhaps i should be more detailed.
<<quoted lines omitted: 3>>
> result should look like this > 2;615165151;L;20.15;9999456
Or this works too.
>> data: {2;"615165151";"L";20.15;9999456}
== {2;"615165151";"L";20.15;9999456}
>> trim/with data {"}
== "2;615165151;L;20.15;9999456" Allen K

 [11/16] from: stefan:falk:slg:se at: 16-Aug-2000 15:43


Hi, try this one then: file: read/lines %file foreach line file [parse line [any [to {"} mark: (remove/part mark 1)]]]
>> file: read/lines %file
== [{2;"615165151";"L";20.15;9999456} {2;"615165151";"L";20.15;9999456} {2;"615165151";"L";20 .15;9999456} {2;"615165151";"L";20.15;...
>> foreach line file [parse line [any [to {"} mark: (remove/part mark 1)]]]
== false
>> print file
2;615165151;L;20.15;9999456 2;615165151;L;20.15;9999456 2;615165151;L;20.15;9999456 2;6151651 51;L;20.15;9999456 2;615165151;L;20.15;9999456 2;615165151;L;20.15;9999456
>>
/Regards Stefan Falk

 [12/16] from: sqlab:gmx at: 16-Aug-2000 15:53


> Hi Brett, > that was not was i was searching for. Perhaps i should be more detailed.
<<quoted lines omitted: 6>>
> Hope you can help. > Thorsten
Try replace/all file-content {"} {} or replace/all file-content "^"" "" There are a few other methods like to-char 34 a.s.o -- Sent through GMX FreeMail - http://www.gmx.net

 [13/16] from: ralph:abooks at: 16-Aug-2000 10:05


> Anyway, I'm starting to develop a complex here, this is the second > grammatically focussed peeved response I've provoked with my > mails. :) I'm > certainly learning a few things about English. > > As for pet peeves, what really peeves me, is poor eating habits. Um, on > second thoughts, better not get into that... >
Brett: Please don't take me too seriously<g>; after all, I am a poor eater. --Ralph

 [14/16] from: bhandley:zip:au at: 17-Aug-2000 0:12


I can't let Allen finish with that...;) You could also do
>> rejoin parse/all {2;"615165151";"L";20.15;9999456} {"}
== "2;615165151;L;20.15;9999456" Not quite as elegant though. Brett.

 [15/16] from: alex:pini:mclink:it at: 16-Aug-2000 19:41


>- Open Your Mind -<
Quoting from [moeller_thorsten--gmx--de's] message (16-Aug-00 15:11:39). m> i got a file with lines like this: m> m> 2;"615165151";"L";20.15;9999456 m> m> what i need is a way to get rid of the quotes including informations. the m> result should look like this m> m> 2;615165151;L;20.15;9999456 CSV ("comma" separated variable) coming from excel, by any chance? What if the quoted variable has a quote *inside*? Does the line look like this? 2;""15" long blade"";"L";20.15;9999456 If that's the case, all the solutions presented until now will break your code. I saw a good parsing function for this problem, but I'll let the author put it out. (-; (I negotiated the problem by brutal ad-hoc substitutions, which wouldn't work in the general case) On the other hand, if you're *absolutely sure* no quote is part of the actual data, go ahead with any of the aforementioned solutions. :-) Alessandro Pini ([alex--pini--mclink--it]) Some parse to remember, some parse to forget (-: Eagles :-)

 [16/16] from: moeller_thorsten:gmx at: 17-Aug-2000 14:55


Hi everybody, just a thanks to everybody giving me the necessary tips to solve my problem. Thorsten

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted