StringTools - Maple Programming Help

Home : Support : Online Help : Programming : Names and Strings : StringTools Package : Encodings : StringTools/DecodeEntities

StringTools

 DecodeEntities
 convert UTF-8 special characters to HTML entities in a string

 Calling Sequence DecodeEntities( s )

Parameters

 s - string; Maple string

Description

 • The DecodeEntities(s) command converts HTML entities in the input string s to UTF-8 characters.
 • The conversion recognizes named entities like "π" as well as hex and decimal Unicode entities like "π" and "π".

Examples

 > $\mathrm{with}\left(\mathrm{StringTools}\right):$
 > $r≔\mathrm{DecodeEntities}\left("\pi + \pi + \pi "\right)$
 ${r}{≔}{"\pi + \pi + \pi "}$ (1)
 > $\mathrm{convert}\left(r,\mathrm{bytes}\right)$
 $\left[{207}{,}{128}{,}{32}{,}{43}{,}{32}{,}{207}{,}{128}{,}{32}{,}{43}{,}{32}{,}{207}{,}{128}\right]$ (2)
 > $r≔\mathrm{DecodeEntities}\left("エンコード"\right)$
 ${r}{≔}{"エンコード"}$ (3)
 > $r≔\mathrm{EncodeEntities}\left(r\right):$$\mathrm{lprint}\left(r\right)$
 "エンコード"
 > $\mathrm{pichar}≔\mathrm{DecodeEntities}\left("\pi "\right)$
 ${\mathrm{pichar}}{≔}{"\pi "}$ (4)
 > $r≔\mathrm{EncodeEntities}\left(\mathrm{cat}\left("Is",\mathrm{pichar},"> 3.14"\right)\right):$$\mathrm{lprint}\left(r\right)$
 "Is π > 3.14"

Compatibility

 • The StringTools[DecodeEntities] command was introduced in Maple 2018.