Helpers.Convert Functions

The table Helpers.Convert holds some useful conversion functions.

  • HL.Convert.BytesTo(bytes, target, decimals)
  • HL.Convert.ForTextOut(text)
  • HL.Convert.HTML2Hollywood(text)
  • HL.Convert.HTMLAmper2UTF8(html_amper)
  • HL.Convert.HTMLTag2HollywoodTag(html_tag)
  • HL.Convert.Unicode2UTF8(value)


HL.Convert.BytesTo(bytes, target, decimals)

converted = HL.Convert.BytesTo(bytes, target, decimals)

Convertes the bytes specified in 'bytes' into the 'target' unit, the result will have 'decimals' decimal positions.

INPUT

  • bytes : The bytes value to convert
  • target : The conversion target, can be one of the following constants :
    → #HL_KILOBYTES
    → #HL_MEGABYTES
    → #HL_GIGABYTES
    → #HL_TERABYTES
  • decimals : How many decimals the results should have (default = 0)

OUTPUT

  • converted : The value after the conversion.


HL.Convert.ForTextOut(text)

converted = HL.Convert.ForTextOut(text)

Escape square brackes not part of Hollywood tags to avoid errors with the native TextOut() function.

INPUT

  • text : Text to be converted

OUTPUT

  • converted : Converted text


HL.Convert.HTML2Hollywood(text)

converted = HL.Convert.HTML2Hollywood(text)

Convert the given HTML 'text' into a text formatted with Hollywood tags.

INPUT

  • text : The HTML text to convert

OUTPUT

  • converted : The converted text

NOTES
Currently handled HTML entities are:
✔ Slashes ✔ Double-Slashes ✔ Tabs
HTML Tags (see HL.HTML_Tags table)
HTML Ampersands (see HL.HTML_Amper table)
✔ Ordered lists
✔ Unordered lists



HL.Convert.HTMLAmper2UTF8(html_amper)

converted = HL.Convert.HTMLAmper2UTF8(html_amper)

Convert the given 'html_amper' into an UTF8 encoded string

INPUT

  • html_amper : The HTML amper to convert

OUTPUT

  • converted : The encoded text

NOTES
The table HL.HTML_Amper holds all supported conversions.



HL.Convert.HTMLTag2HollywoodTag(html_tag)

converted = HL.Convert.HTMLTag2HollywoodTag(html_tag)

Convert the given 'html_tag' into stardard text Hollywood's tags where possible.

INPUT

  • html_tag : The HTML tag to convert

OUTPUT

  • converted : The converted tag

NOTES
The table HL.HTML_Tags holds all supported conversions.



HL.Convert.Unicode2UTF8(value)

converted = HL.Convert.Unicode2UTF8(value)

Encode 'value', an hexadecimal string WITHOUT any prefixes ($, 0x), to the corresponding UTF8 string.

INPUT

  • value : The hexadecimal value to convert without any prefix

OUTPUT

  • converted : The encoded UTF8 string

NOTES
Additional informations here.

hollywoodlibs/helpers/convert.txt · Ultima modifica: 2016/10/11 18:25 da admin
CC Attribution-Noncommercial 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0