声明:本空间的内容不全部是原创,如有雷同只为学习与借鉴之方便,别无它意,来者是朋友,愿通过此平台结交天下测试达狼!

vbscript 实现字符2种不同方式颠倒(原创)

上一篇 / 下一篇  2013-05-21 13:43:40 / 个人分类:QTP

''- - - - - -example 1 - - - -  - - 字符串按着字节颠倒51Testing软件测试网a}4hY Y
Option Explicit
B9C8b?T0Dim str151Testing软件测试网%sQ] _;^+\n
str1="welcome to beijing"51Testing软件测试网c&f^#I uwQ)b tL!s
Dim arry(3)
)G@'\G ^ ZYK O0arry(0)=right(str1,7)51Testing软件测试网nTl4Y6NVGB
arry(1)=mid(str1,9,2)
5c+srYx.fj@t#`~}0arry(2)=left(str1,7)
e8v["x;@T(B"y e z0msgbox join (arry) '  beijing to welcome
'- - - - - - - - - - - - - - -  - - 按着字节颠倒
 
 
- - - - - -example 2 - - - -  - - 字符串完全颠倒显示51Testing软件测试网3AR E!{i"fm7w Vh
'Option Explicit51Testing软件测试网`x7wVx'iN.JE} ^
Dim str1,str1l51Testing软件测试网3]v D1Tih9J
str1="welcome to beijing"51Testing软件测试网_2N!B:D[v3b
str1l=len(str1)
)E;EA$fX0msgbox str1l-1
/{,a:@G mjk+HW0'Dim str2(str1l-1)' such as define,will  report "Expected integer constant"
c8@ V)w3N:Y"C0reDim str2(str1l-1)
\(}TJ H9u9vl0Dim i
rb I1I&x\tG`0i=str1l-1
5Y&}3SE8P T+Y:N.F0while(i>=0)51Testing软件测试网 bFlw+^
str2(i)=mid(str1,str1l-i,1)
P j;Zs*b Z2}0i=i-1
wend
msgbox join (str2) ' gnij ieb ot  emoclew
'- - - - - -example 2 - - - -  - - 字符串完全颠倒显示

TAG:

 

评分:0

我来说两句

Open Toolbar