Using a hash symbol (#) but not for comment

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 539
Joined: Sun Dec 18, 2011 7:23 pm
Contact:

Using a hash symbol (#) but not for comment

Post by kaveh1000 » Fri Aug 30, 2024 4:06 pm

I should know this but I need to replace some text with a string that includes a # character. How can I override its normal use as a comment? e.g. part of string is:

Code: Select all

...color=\"\#FF0000\"\>...
Kaveh

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10090
Joined: Fri Feb 19, 2010 10:17 am

Re: Using a hash symbol (#) but not for comment

Post by richmond62 » Fri Aug 30, 2024 4:57 pm

Presumably a hash sign that is enclosed in double quotes will be treated as a string.

kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 539
Joined: Sun Dec 18, 2011 7:23 pm
Contact:

Re: Using a hash symbol (#) but not for comment

Post by kaveh1000 » Sat Aug 31, 2024 11:16 am

Thanks Richmond. It's a complex regex pattern and quotes makes it more complex. So I used an unusual character (●) then replaced it just before using...
Kaveh

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10090
Joined: Fri Feb 19, 2010 10:17 am

Re: Using a hash symbol (#) but not for comment

Post by richmond62 » Sat Aug 31, 2024 11:40 am

Read Treasure Island: you'll never use a black spot again. 8)

kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 539
Joined: Sun Dec 18, 2011 7:23 pm
Contact:

Re: Using a hash symbol (#) but not for comment

Post by kaveh1000 » Sat Aug 31, 2024 11:41 am

Not going there. Will not give up my black spot. ;-)
Kaveh

Post Reply