Entity decode: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Bale
Created page with '{{ #vardefine:name|entity_decode}}{{ #vardefine:return_type|string}}{{ #vardefine:aggregate|no}}{{ FunctionPage| name={{#var:name}}| function_category=Relay Browser Functions| …'
 
imported>Bale
mNo edit summary
Line 6: Line 6:
FunctionPage|
FunctionPage|
name={{#var:name}}|
name={{#var:name}}|
function_category=Relay Browser Functions|


function1={{Function|
function1={{Function|
Line 35: Line 34:
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]]

Revision as of 05:26, 22 May 2010

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()

More Information

See User Interface Scripts for more information.