Entity decode: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Bale
mNo edit summary
imported>Ulti
expanding the "see also" to keep the url_ and entity_ encode/decode functions together as you'd expect
 
Line 31: Line 31:
</syntaxhighlight>}}|
</syntaxhighlight>}}|


see_also={{SeeAlso|form_field||entity_encode|write|writeln}}|
see_also={{SeeAlso|form_field||entity_encode|write|writeln|url_decode|url_encode}}|
more_info=See [[Relay_Override_Scripting#User_Interface_Script|User Interface Scripts]] for more information.|
more_info=See [[Relay_Override_Scripting#User_Interface_Script|User Interface Scripts]] for more information.|
}}
}}


[[Category:Relay Browser Functions]]
[[Category:Relay Browser Functions]]

Latest revision as of 16:46, 14 October 2014

Function Syntax

string entity_decode(string value )

  • string value  to be decoded.

Used for retrieving text from form fields that contains special characters such as ampersands and angle brackets.

Code Sample

Checks a form field in a UI script to determine if it is a monster name.

string monstervalidator(string name) {
   monster it = to_monster(fields[name]);
   if (it == $monster[none]) {
      return "A valid monster is required.";
   }
   fields[name] = entity_decode(it);	// normalize
   return "";
}

See Also

form_field() | entity_encode() | write() | writeln() | url_decode() | url_encode()

More Information

See User Interface Scripts for more information.