Remove quote marks & LEFT(), RIGHT() ?
[1/9] from: ddalley:idirect at: 15-Dec-2000 13:07
Hi, folks:
The following questions are all related:
What is the REBOL way of removing quotes (") from strings?
Alternatively, how do we PARSE using quotes as targets?
How are we supposed to do LEFT() RIGHT() operations?
It seems that MAKE FILE! does not work with file-name"
and we can't use a quote mark as a target: """.
--
---===///||| Donald Dalley |||\\\===---
The World of AmiBroker Support
http://webhome.idirect.com/~ddalley
UIN/ICQ#: 65203020
[2/9] from: kevin:sunshinecable at: 15-Dec-2000 10:43
On Fri, 15 Dec 2000, Donald Dalley wrote:
> What is the REBOL way of removing quotes (") from strings?
You need to escape the quote. To remove all quotes from a string:
replace/all src-string "^"" ""
> Alternatively, how do we PARSE using quotes as targets?
Same idea. Escape the " with a ^.
Here's a sample line ripped from one of my web miners that uses " as
targets.
parse/all b [ any [copy c to "onClick=^"" copy e thru "false;^"" (append d c)] ]
Cheers,
Kev
[3/9] from: gchiu:compkarori at: 16-Dec-2000 8:42
On Fri, 15 Dec 2000 13:07:31 REBOL Time Zone
Donald Dalley <[ddalley--idirect--com]> wrote:
> What is the REBOL way of removing quotes (") from
> strings?
this is another way:
>> test: {This is a "test}
== {This is a "test}
>> replace/all test {"} ""
== "This is a test"
--
Graham Chiu
[4/9] from: ddalley:idirect at: 15-Dec-2000 15:02
Kev & Graham:
I didn't find escaping in the docs and I didn't know about {} until I saw
another parsing thread.
The script is still not working completely, but I am closer.
Thanks!
On 15-Dec-00, Kevin McKinnon wrote:
> On Fri, 15 Dec 2000, Donald Dalley wrote:
> > What is the REBOL way of removing quotes (") from strings?
> You need to escape the quote. To remove all quotes from a string:
> replace/all src-string "^"" ""
--
---===///||| Donald Dalley |||\\\===---
The World of AmiBroker Support
http://webhome.idirect.com/~ddalley
UIN/ICQ#: 65203020
[5/9] from: allenk:powerup:au at: 16-Dec-2000 10:05
Since you aren't replacing it with anything, just use trim/with (instead of
using replace).
trim/with {This is a "test} {"}
== "This is a test"
you can also use trim/with to remove many characters in one pass
trim/with {this is a test} {aeiou}
== "ths s tst"
Cheers,
Allen K
[6/9] from: ddalley::idirect::com at: 15-Dec-2000 22:43
On 16-Dec-00, Allen Kamp wrote:
> Since you aren't replacing it with anything, just use trim/with (instead of
> using replace).
> trim/with {This is a "test} {"}
> == "This is a test"
Yes, I wanted to use TRIM/WITH, but I didn't see a docs/example of how to do
it with escaping a quote mark, until later.
Thanks, Allen.
--
---===///||| Donald Dalley |||\\\===---
The World of AmiBroker Support
http://webhome.idirect.com/~ddalley
UIN/ICQ#: 65203020
[7/9] from: mat:eurogamer at: 16-Dec-2000 16:42
Heya Donald,
DD> Yes, I wanted to use TRIM/WITH, but I didn't see a docs/example of how to do
DD> it with escaping a quote mark, until later.
Along these lines, is there a super elegant way to strip off leading
and/or trailing spaces from a string? IE not knowing if they exist
etc.
--
Mat Bettinson - EuroGamer's Gaming Evangelist with a Goatee
http://www.eurogamer.net | http://www.eurogamer-network.com
[8/9] from: gchiu:compkarori at: 17-Dec-2000 6:53
On Sat, 16 Dec 2000 16:42:17 +0000
Mat Bettinson <[mat--eurogamer--net]> wrote:
> Along these lines, is there a super elegant way to strip
> off leading
> and/or trailing spaces from a string? IE not knowing if
> they exist
> etc.
trim str
--
Graham Chiu
[9/9] from: mat:eurogamer at: 16-Dec-2000 18:32
Heya Graham,
GC> trim str
I tried that. Hmm, in the console it's working. Musta been something
wrong with my script elsewhere. Doh!
--
Mat Bettinson - EuroGamer's Gaming Evangelist with a Goatee
http://www.eurogamer.net | http://www.eurogamer-network.com