如何对VB中得到的字符串进行操作?
要求把字符串中的每个字母做转换比如把"zApple"转换成"aBqqmf"(只做了+1操作,但是z是到a的)VB中好象不能定义char类型,只能求助大家了...
要求把字符串中的每个字母做转换
比如把"zApple"转换成"aBqqmf"(只做了+1操作,但是z是到a的)
VB中好象不能定义char类型,只能求助大家了 展开
比如把"zApple"转换成"aBqqmf"(只做了+1操作,但是z是到a的)
VB中好象不能定义char类型,只能求助大家了 展开
展开全部
private function StringConversion(byval cString as string) as string
dim i,iStrLen as integer
dim tmpStr,tmpChar as string
iStrLen = len(cString)
tmpStr = ""
for i = 1 to iStrLen
tmpChar = mid$(cString,i,1)
if (asc(tmpChar) >= asc("A") and asc(tmpChar) <asc("Z")) then
tmpChar = chr(asc(tmpChar) + 1)
elseif (asc(tmpChar) = asc("Z")) then
tmpChar = "A"
endif
if (asc(tmpChar) >= asc("a") and asc(tmpChar) <asc("z")) then
tmpChar = chr(asc(tmpChar) + 1)
elseif (asc(tmpChar) = asc("z")) then
tmpChar = "a"
endif
tmpStr = tmpStr + tmpChar
next
StringConversion = tmpStr
end function
dim i,iStrLen as integer
dim tmpStr,tmpChar as string
iStrLen = len(cString)
tmpStr = ""
for i = 1 to iStrLen
tmpChar = mid$(cString,i,1)
if (asc(tmpChar) >= asc("A") and asc(tmpChar) <asc("Z")) then
tmpChar = chr(asc(tmpChar) + 1)
elseif (asc(tmpChar) = asc("Z")) then
tmpChar = "A"
endif
if (asc(tmpChar) >= asc("a") and asc(tmpChar) <asc("z")) then
tmpChar = chr(asc(tmpChar) + 1)
elseif (asc(tmpChar) = asc("z")) then
tmpChar = "a"
endif
tmpStr = tmpStr + tmpChar
next
StringConversion = tmpStr
end function
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询