1.判断字符类型
for(1 -eq 1){
[char]$ch=read-Host "请输入一个字符"
$a="\d{1}"
$b="[a-z]{1}"
$c="[A-Z]{1}"
if($ch -cmatch $a){
Write-Output($ch+":是一个数字")
}elseif($ch -cmatch $b){
Write-Output($ch+":是小写字母")
}elseif($ch -cmatch $c){
Write-Output($ch+":是大写字母")
}else{
Write-Output($ch+":是符号")
}
return
}
While(1 -eq 1){
[char]$str = Read-Host "请输入1个字符"
[int]$asc = [char]$str
if($asc -ge 48 -and $asc -le 57){
Write-Output ($str + ":这个字符是数字")
}
elseif($asc -ge 65 -and $asc -le 90){
Write-Output ($str + ":这个字符是大写字母")
}
elseif($asc -ge 97 -and $asc -le 122){
Write-Output ($str + ":这个字符是小写字母")
}
else{
Write-Output ($str + ":这个字符是符号")
}
break
}
[string]$str = Read-Host "请输入1个字符串"
[char[]]$ascii = $str.ToCharArray()
$a,$b,$c,$d = 0,0,0,0
for($i = 0 ;