12345
.tostring("n
");
//生成 12,345.00
12345
.tostring("c
");
//生成¥12,345.00
12345
.tostring("e
");
//生成 1.234500e+004
12345
.tostring("f4
");
//生成 12345.0000
12345
.tostring("x
");
//生成 3039 (16進製制)
12345
.tostring("p
");
//生成 1,234,500.00%
取字串長度,如:
string
str="中國
";intlen
=str.length;
把字元轉為數字,查**點,注意是單引號。如:
response.write((
int)'中
');
//結果為中字的**:20013
把數字轉為字元,查**代表的字元。如:
response.write((
char
)22269
);
//返回「國」字
C 字串常用的方法
字串的簡單使用 string name1 hello string name2 hello 利用字串的str.length 屬性求字串的長度 console.writeline the length of is name1,name1.length properity string name1u n...
陣列和字串常用方法
let arr pop 刪除陣列的最後乙個元素,返回被刪除的元素 let arr 1 2,3 arr.pop 3 push 向陣列尾部新增乙個或多個元素,返回新的陣列長度 let arr 1 2,3 arr.push 4 findindex 找到滿足條件的元素並返回該元素的index let ind...
字串常用方法
字串常用方法 public class 3 abc 5 int indexof string str 輸出字串2在字串1中的下標 system.out.println hello crl endswith crl 6 6int indexof string str,int fromindex 在字串...