Internal functions/Conversion functions

From Avisynth

Jump to: navigation, search

[edit] Conversion functions

These functions convert between different types. There are also some numeric functions that can be classified in this category, namely: Ceil, Floor, Float, Int and Round.

  • Value   |   v2.07   |   Value(string)
Converts a decimal string to its associated numeric value.
Examples:
Value ("-2.7") = -2.7
  • HexValue   |   v2.07   |   HexValue(string)
Converts a hexadecimal string to its associated numeric value.
Examples:
HexValue ("FF00") = 65280
  • String   |   v2.07   |   String(float / int [, string format_string])
Converts a variable to a string.
If the variable is float or integer, it first converts it to a float and then uses format_string to convert the float to a string. The syntax of format_string is as follows:
%[flags][width][.precision]f
width: the minimum width (the string is never truncated)
precision: the number of digits printed
flags:
- left align (instead right align)
+ always print the +/- sign
0 padding with leading zeros
' ' print a blank instead of a "+"
# always print the decimal point
Examples:
Subtitle( "Clip height is " + String(last.height) )
String(1.23, "%f") = '1.23'
String(1.23, "%5.1f") = ' 1.2'
String(1.23, "%1.3f") = '1.230'
String(24, "%05.0f") = '00024'

Back to Internal functions.

Personal tools