|
本帖最后由 newuser 于 2010-4-8 08:21 编辑
以下是练习,没技术含量,呵呵!
谁能告诉我 StringSplit($Name," ",0) 和 StringSplit($Name," ",1) 的区别?
Dim $Name="My name is zougk! Welcome to my style"
Dim $Str1,$Str2,$Str3,$Str4,$Str5,$Str6,$Str7,$Str8,$Str9,$Str10,$Str11,$Str12
Dim $Len
$Str1=StringLeft($Name,16)
MsgBox(0,"StringLeft'use",$Str1)
$Str2=StringRight($Name,19)
MsgBox(0,"StringRight'use",$Str2)
$Str3=StringMid($Name,12,5)
MsgBox(0,"StrintgMid'use",$Str3)
$Len=StringLen($Name)
MsgBox(0,"变量$Name的长度","字符串"&$Name&"的长度是:"&$Len&"位")
$Str4=StringUpper($Name)
MsgBox(0,"小写字母变大写",$str4)
$Str5=StringLower($Name)
MsgBox(0,"大写字母变小写",$Str5)
$Str6=StringReplace($Name,"zougk","zouyy")
MsgBox(0,"字符串指定内容替换",$Str6)
$Str7=StringSplit($Name," ",0)
MsgBox(0,"字符串按空格进行分割","第1个字母"&$Str7[1]&" "&"第2个字母"&$Str7[2]) ;之后省略吧
$Str8=StringSplit($Name,"",1)
MsgBox(0,"字符串按单词逐个分割","第1个字母"&$Str8[1]&" "&"第2个字母"&$Str8[2]) ;之后省略吧
;谁能告诉我 StringSplit($Name," ",0) 和 StringSplit($Name," ",1) 的区别?
$Str9=StringStripWS($Name,8)
MsgBox(0,"去掉字符串中的所有空格空格",$str9) ;StringStripWS("字符串",标志) 标志为8是去掉所有空格,还可以设置为1 2 4
$Str10=StringTrimLeft($Name,17)
MsgBox(0,"从左截掉指定数量的字符后剩余的字符串",$Str10)
$Str11=StringTrimRight($Name,19)
MsgBox(0,"从右截掉指定数量的字符后剩余的字符串",$Str11)
$Str12=StringIsAlNum($Name) ;判定$Name是否完全是字母或数字,是返回1,因有 空格 和 ! ,所以返回0
;StringIsAlpha("string") 判定string是否完全是字母
MsgBox(0,"字符串是否完全是字母",$Str12)
$Str13=StringInStr($Name,"my",0)
;StringInStr("字符串","子字符串",是否区分大小写 0是不区分大小写,出现次序
MsgBox(0,"检查字符串中是否包含指定的子字符串",$Str13)
$Str14=StringInStr($Name,"my",1,1)
MsgBox(0,"检查字符串中是否包含指定的子字符串",$Str14) |
评分
-
查看全部评分
|