autoit3转换php,AutoIt3处理字符串和数组

autoit3转换php,AutoIt3处理字符串和数组1 字符串和数组应用 include 字符串的大小写转换 str01 abdcefg result01 StringUpper str01 result02 StringLower result01 MsgBox 64 大小写转换结果 大写 amp result01 amp Chr 13 amp 小写 amp result02

1.  字符串和数组应用

#include

;字符串的大小写转换

$str01 = “abdcefg”;

$result01 = StringUpper($str01);

$result02 = StringLower($result01);

MsgBox(64,”大小写转换结果”,”大写:” & $result01 & Chr(13) & “小写:” & $result02);

;字符串的长度

$str02 = “acer01acer02acer03acer04acer05”;

$len = StringLen($str02);

MsgBox(64,”长度”,”字符串的长度为:” & $len );

;返回指定数量的字符串

$str03 = StringLeft($str02,12);

$str04 = StringRight($str02,12);

MsgBox(64,”返回指定字符数”,”左边的12个字符:” & $str03 & Chr(13) & “右边的12个字符:” & $str04);

;字符串替换

$str05 = “a-b-c-d-e-f-g”;

$str06 = StringReplace($str05,”-“,”=”);

$replaceNum = @extended;

MsgBox(64,”字符替换”,”原串:” & $str05 & Chr(13) & “替换后的串:” & $str06 & Chr(13) & “替换个数:” & $replaceNum);

;字符串分割

$str07 = “123,456,789,0,a,d,gg”;

$array01 = StringSplit($str07,”,”,1);

MsgBox(64,”分割字符串”, “分割后的数量:” & $array01[0] & Chr(13) & “第3个串:” & $array01[3]);

MsgBox(64,”数组长度”, “长度:” & $array01[0]);

;将字符串转换为数组

$array02 = StringToASCIIArray($str01);;默认为UNICODE

$array03 = StringToASCIIArray($str01,”GBK”);

$array04 = StringToASCIIArray($str01,2,4,”GBK”);;从第2个开始第5个结束

_ArrayDisplay($array02,””);

_ArrayDisplay($array03,””);

MsgBox(64,”数组长度”, “长度:” & $array02[0]);

2. 字符串转数组

; Binary ANSI to String

$buffer = StringToBinary(“Hello – 你好”)

MsgBox(4096, “String() representation” , $buffer)

$buffer = BinaryToString($buffer)

MsgBox(4096, “BinaryToString() ANSI representation” , $buffer)

; Binary UTF16-LE to String

$buffer = StringToBinary(“Hello – 你好”, 2)

MsgBox(4096, “String() representation” , $buffer)

$buffer = BinaryToString($buffer, 2)

MsgBox(4096, “BinaryToString() UTF16-LE representation” , $buffer)

; Binary UTF16-BE to String

$buffer = StringToBinary(“Hello – 你好”, 3)

MsgBox(4096, “String() representation” , $buffer)

$buffer = BinaryToString($buffer, 3)

MsgBox(4096, “BinaryToString() UTF16-BE representation” , $buffer)

; Binary UTF8 to String

$buffer = StringToBinary(“Hello – 你好”, 4)

MsgBox(4096, “String() representation” , $buffer)

$buffer = BinaryToString($buffer, 4)

MsgBox(4096, “BinaryToString() UTF8 representation” , $buffer)

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/231406.html原文链接:https://javaforall.net

(0)
上一篇 2025年12月15日 下午12:01
下一篇 2025年12月15日 下午12:22


相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号