begin
case edit1.Text of
'k':showmessage('kkkkkkk');
's':showmessage('sssssss');
'l':showmessage('lllllll');
end;
end;
我现在写错了,请问各位大哥,这样CASE OF我该怎么写才对。

解决方案 »

  1.   

    case 结构不支持了符串检索
      

  2.   

    Case Of不支持字符串的!这与VB,VC不同的!可以是
    case edit1.Text[1] of
    'k':showmessage('kkkkkkk');
    's':showmessage('sssssss');
    'l':showmessage('lllllll');
    end;呵呵
      

  3.   

    也可以这样
    const
       strArray : array [0..10] of string =(['str0', 'str1', 'str2', ...);for i := 0 to 10 do
      if strArray[i] = str then
    case i of
      0: do str1 thing
      1: do str1 thing
      2:
      ...
    end;
      

  4.   

    Unit  StrUtilsj:=AnsiIndexText(edit1.Text, ['A', 'B', 'C', 'D','H','P','I','F','J','L','G','K','N','M','O']);
     可用此函数取字符index.
     然后:
     case j of
      0:  showmessage('A');
      1:  showmessage('B');
       .....
     end;
      

  5.   

    楼上的都说出来了
    就是这个意思 
    case  **  of 
      **是个排序的意思了
      诸如用1,2,3
      

  6.   

    Case Of不支持字符串的!这与VB,VC不同的!可以是
    case edit1.Text[1] of
    'k':showmessage('kkkkkkk');
    's':showmessage('sssssss');
    'l':showmessage('lllllll');
    end;呵呵
    // 好像VC 也不支持字符串吧 
    char c;
    switch c
    {
      case 'c':
      case 'C':....
    }
      

  7.   

    如果只判断字符串的话,那我就只有用IF了吗?
      是。
      如果不用其他类似于上面的case string[0]之类的手段
      

  8.   

    case of 只支持序数类型!