bug found with square bracket

Report any Hollywood bugs here
Post Reply
xabierpayet
Posts: 267
Joined: Fri Feb 24, 2012 9:34 am

bug found with square bracket

Post by xabierpayet »

I found a bug, how i can solve this problem with the open square bracket?

code.

cc="(Kr) 4d8 5s1"
ces=ReplaceStr(cc,"(","\[")
ces=ReplaceStr(cc,")","\]")
DebugPrint(ces)

output.

(Kr] 4d8 5s1
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: bug found with square bracket

Post by airsoftsoftwair »

Huh, why are you escaping the square bracket? That shouldn't be done. Is that what you're looking for?

Code: Select all

cc="(Kr) 4d8 5s1"
ces=ReplaceStr(cc,"(","[")
ces=ReplaceStr(ces,")","]")
DebugPrint(ces)
xabierpayet
Posts: 267
Joined: Fri Feb 24, 2012 9:34 am

Re: bug found with square bracket

Post by xabierpayet »

hello andreas, if i don´t escape i have this error, the item is in a table
item to print ---->[Ar] 3d5 4s2

Error in line 684 (Taula.hws): Text format tag after square bracket not recognized!
xabierpayet
Posts: 267
Joined: Fri Feb 24, 2012 9:34 am

Re: bug found with square bracket

Post by xabierpayet »

i test with a table alone now and the result is the same, error

code:

ces={}
ces[0]="[Kr] 4d8 5s1"
DebugPrint(ces[0])
Print(ces[0])

debug:

Error in line 4 (Unnamed1): Text format tag after square bracket not recognized!
PEB
Posts: 567
Joined: Sun Feb 21, 2010 1:28 am

Re: bug found with square bracket

Post by PEB »

I can't test this right now, but I think the way I've done it before was to replace "[" with "[[" and replace "]" with '']]" (double brackets).
xabierpayet
Posts: 267
Joined: Fri Feb 24, 2012 9:34 am

Re: bug found with square bracket

Post by xabierpayet »

thanks for your repply Peb, this is working fine with your method!

code:

electroconfigsemantic="[Ar] 3d10 4s2 4p2"
ss=ReplaceStr(electroconfigsemantic,"[","[[")
ss=ReplaceStr(ss,"]","]]")

debugprint result ---> [[Ar]] 3d10 4s2 4p2

textout result ----->[Ar] 3d10 4s2 4p2

interesting
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: bug found with square bracket

Post by airsoftsoftwair »

xabierpayet wrote: Tue Aug 30, 2022 6:51 pm interesting
It's all documented here. Quote:
Please note that because of these format tags you have to use two square brackets if you want to have a square bracket in your text. If there is only one square bracket Hollywood will always expect a format tag.
So not a bug.
xabierpayet
Posts: 267
Joined: Fri Feb 24, 2012 9:34 am

Re: bug found with square bracket

Post by xabierpayet »

correct, the problem is solved, thanks again.
Post Reply