Processing, str()
用法介紹。
說明
將原始數據類型(boolean
、byte
、char
、int
或 float
)的值轉換為其 String
表示。例如,使用 str(3)
轉換整數將返回 "3"
的 String
值,使用 str(-12.6)
轉換浮點數將返回 "-12.6"
,使用 str(true)
轉換布爾值將返回 "true"
。
當傳入一個值數組時,將返回一個相同長度的String
數組。
例子
boolean b = false;
byte y = -28;
char c = 'R';
float f = -32.6;
int i = 1024;
String sb = str(b);
String sy = str(y);
String sc = str(c);
String sf = str(f);
String si = str(i);
sb = sb + sy + sc + sf + si;
println(sb); // Prints 'false-28R-32.61024'
相關用法
- Processing strokeJoin()用法及代碼示例
- Processing strokeWeight()用法及代碼示例
- Processing stroke()用法及代碼示例
- Processing strokeCap()用法及代碼示例
- Processing static用法及代碼示例
- Processing scale()用法及代碼示例
- Processing splice()用法及代碼示例
- Processing super用法及代碼示例
- Processing subset()用法及代碼示例
- Processing saveJSONArray()用法及代碼示例
- Processing saveXML()用法及代碼示例
- Processing switch用法及代碼示例
- Processing sqrt()用法及代碼示例
- Processing serverEvent()用法及代碼示例
- Processing save()用法及代碼示例
- Processing saveStrings()用法及代碼示例
- Processing saveTable()用法及代碼示例
- Processing shorten()用法及代碼示例
- Processing saturation()用法及代碼示例
- Processing settings()用法及代碼示例
- Processing spotLight()用法及代碼示例
- Processing setLocation()用法及代碼示例
- Processing splitTokens()用法及代碼示例
- Processing setResizable()用法及代碼示例
- Processing specular()用法及代碼示例
注:本文由純淨天空篩選整理自processing.org大神的英文原創作品 str()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。