我是一个初学者.
判断某一值有没有在几个值内的程序怎么写?
一个输入框,一个LABEL,
比如,如果china 在USA,DFA,FFDA,FDA中,label显示'ok',否则显示'no'.
比旭如果输入ss,label就显示'no',最好能写出程序.谢谢了想用集合或者数组

解决方案 »

  1.   

    S1:='USA,DFA,FFDA,FDA中,label';
    if pos(',China,',s1+',')>0 then label.capyion ;= 'yes' else label.caption := 'no';
      

  2.   

    if trim(edit1.text) in (USA,DFA,FFDA,FDA) then 
    showmessage('ok!') 
    else 
    showmessage('no');
      

  3.   

    if trim(edit1.text) in ('USA','DFA','FFDA','FDA') then 
    Label1.caption:='ok'
    else 
    Label1.caption:='no'
      

  4.   

    if trim(edit1.text) in ('USA','DFA','FFDA','FDA') then 
    Label1.caption:='ok'
    else
    Label1.caption:='no';
    if trim(edit1.text)='ss' then
    label1.caption:='ok'
    else
    Label1.caption:='no';