首页 > 文档 > hex()十六进制转换
2017
07-20

hex()十六进制转换

Name

hex()十六进制转换

   

Examples

color c = #ffcc00;

println(c); // Prints “-13312”

println(hex(c)); // Prints “FFFFCC00”

println(hex(c, 6)); // Prints “FFCC00”

hex()十六进制转换 - 第1张  | Processing编程艺术

color c = color(255, 204, 0);

println(c); // Prints “-13312”

println(hex(c)); // Prints “FFFFCC00”

println(hex(c, 6)); // Prints “FFCC00”

Description

Converts an intbytechar, or color to a String containing the equivalent hexadecimal notation. For example, the color value produced by color(0, 102, 153) will convert to the String value “FF006699”. This function can help make your geeky debugging sessions much happier.

Note that the maximum number of digits is 8, because an int value can only represent up to 32 bits. Specifying more than 8 digits will not increase the length of the String further.

int、字节、char 或颜色转换为包含等效十六进制表示法的字符串。例如, 颜色产生的颜色值 (0102153) 将转换为字符串值 “FF006699”。此功能有助于使您的书调试会话更快乐。

 

请注意, 最大位数是 8, 因为 int 值最多只能表示32位。指定8位以上的数字不会进一步增加字符串的长度。

Syntax

hex(value)

hex(value, digits)

Parameters

value

int, char, or byte: the value to convert

 

要转换的值

digits

int: the number of digits (maximum 8)

位数 (最多 8)

Returns

String

Related

unhex()
binary()
unbinary()



最后编辑:
作者:卡萨布兰卡
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。