asp do while与while语句实例

作者:简简单单 2010-10-14




do loop语句实例example21


<%
 chkfirstuntil
 chklastuntil
%>

while语句实例

 

<%
 function checkletter(str)    'str 为要检测的字符串
  checkletter=true    '初始化
  letters="abcdefghijklmnopqrstuvwxyz"  '初始化
  for i=1 to len(str)    'len 函数返回字符串长度
   'mid(str,i,1)返回字符串str第i个字符,ucase函数将该字符转换为大写形式
   checkchar=ucase(mid(str,i,1))
   if (instr(letters,checkchar)<=0) then 'checkchar 在letters中不存在
    checkletter=false
    exit function   '跳出function 过程
   end if
  next      '结束for 循环
 end function
%>


while wend实例example22



 

请输入字符串:>


 



<%
 if request.form("submit")="确定" then
  str=request.form("string")         '读取输入的字符串
  letters="abcdefghijklmnopqrstuvwxyz"    '初始化
  length=len(str)    '输入的字符串的长度
  i=1     '初始化变量
  while i    'mid(str,i,1)返回字符串str第i个字符,ucase 函数将该字符转换为大写形式
   checkchar = ucase(mid(str,i,1))
   if (instr(letters,checkchar)<=0) then 'checkchar 在letters中不存在
    '给出提示
    response.write("")
    response.end   '结束asp文件的执行
   end if
   i=i+1
  wend      '结束while循环
 end if
%>

相关文章

精彩推荐