## page was renamed from DevCenter/Documentation/ExtensionObjects/Units
= Units =
{{{#!rst
Purpose:
Utility methods for extracting units and value from raw strings along with unit-to-unit conversion routines.
Namespace:
urn:WebWorks-XSLT-Extension-Units
Prefix:
wwunits
Methods:
NumericPrefix(string value):
Extract the numeric prefix of the given string.
Returns:
String.
Example:
Determine numeric prefix of ``24px``.
::
UnitsSuffix(string value):
Extract the units suffix of the given string. Only returns a non-zero length string of there is also a numeric prefix.
Returns:
String.
Example:
Determine units of ``24px``.
::
Convert(double sourceValue, string sourceUnits, string targetUnits):
Convert a measurement from one set of units to another.
Returns:
Number.
Example:
Convert ``2in`` to centimeters (``cm``).
::
xx():
xx
Returns:
xx
Example:
xx
RTFColor(string htmlColor):
Convert a standard HTML/CSS color to an RTF color.
Returns:
RTF color as string.
Example:
Convert ``#FF3399`` to an RTF color.
::
CSSRGBColor(string htmlColor):
Convert the given HTML/CSS color to a hex encoded CSS color. Useful for converting named colors such as ``green`` to their hex equivalents.
Returns:
Hex encoded CSS color as string.
Example:
Convert ``green`` to the hex equivalent.
::
EncodingFromCodePage(int codePage):
Determine the HTML encoding for a page given a Windows code page value.
Returns:
String.
Example:
Determine the HTML encoding for code page 23.
::
}}}