Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Problems with SubStr

Hello,

I have another Problem I cannot solve by myself:
I have a Result (e.g. "Dagger (1d6+1)") and try to extract only "Dagger" oder "Dagger ". My try was this:

Set: itm_waf_kompl=[@waf_{input1}]
Set: blank_pos=[{itm_waf_kompl} >> At ' ']
Set: itm_waf=[{itm_waf_kompl} >> SubStr 1 {blank_pos}]

itm_waf_kompl gives "Dagger (1d6+1)" back.
But imt_waf gives only the same String back. My next try was to use the "(" as blank_pos, but then I get the Result "Dagger (". So, how do I get rid of the last 2 Characters (or even the last)?

This doesn't seem to get the right result:

Set: itm_waf_kompl=[@waf_{input1}]
Set: blank_pos=[{itm_waf_kompl} >> At (]
blank_pos=={blank_pos}-1
Set: itm_waf=[{itm_waf_kompl} >> SubStr 1 {blank_pos}]

Has someone any idea?

Thx
WarFred

Comments

  • edited February 16

    I've done it: the calculation was wrong.

    Set: blank_pos2={{$blank_pos}-1}
    Set: itm_waf=[{itm_waf_kompl} >> SubStr 1 {blank_pos2}]

Leave a Comment