Difference between revisions of "Template:CleanUpString"
From Pathfinder Wiki
DesignerThan (talk | contribs) |
DesignerThan (talk | contribs) |
||
Line 1: | Line 1: | ||
− | <includeonly><onlyinclude>{{ | + | <includeonly><onlyinclude>{{#vardefine: cleanedString|{{#replace|{{{string}}}|&|&}} }} |
− | #vardefine: cleanedString|{{#replace|{{{string}}}|&|&}} }}{{ | + | {{#vardefineecho: cleanedString|{{#replace|{{#var:cleanedString}}|'|'}} }}</onlyinclude></includeonly> |
− | #vardefineecho: cleanedString|{{#replace|{{ | ||
This template removes the hexvalue of & and ' characters from strings and replaces them. It is introduced for links because some of them have those in them and won't work if they do. | This template removes the hexvalue of & and ' characters from strings and replaces them. It is introduced for links because some of them have those in them and won't work if they do. | ||
Revision as of 18:17, 19 March 2021
This template removes the hexvalue of & and ' characters from strings and replaces them. It is introduced for links because some of them have those in them and won't work if they do.
How it works
First it takes the input string {{{string}}} and replaces the &. This resuld is saved with #vardefine into the variable cleanedString. Then it takes the cleanedString, previously saved, and replaces the '. That one is saved into cleanedString again, overwritting it's previous content. But as that is the last charakter it is saved with #vardefineecho that is the "return value" of the template!