* vfp題:輸入一個字串,統計其中字母、數字、空格和其他字元的個數。SET TALK OFFCLEARACCEPT "請輸入一個字串:" TO _cstringSTORE 0 TO _nzm,_nsz,_nkg,_nqtFOR _i=1 TO LEN(_cstring) _css=SUBSTR(_cstring,_i,1) DO CASE CASE ISALPHA(_css) _nzm=_nzm+1 CASE ISDIGIT(_css) _nsz=_nsz+1 CASE _css=" " _nkg=_nkg+1 OTHERWISE _nqt=_nqt+1 ENDCASEENDFOR?"經統計:字串“"+_cstring+"”中有"?" "+LTRIM(STR(_nzm))+"個字母;"+LTRIM(STR(_nsz))+"個數字;"+LTRIM(STR(_nkg))+"個空格;"+LTRIM(STR(_nzm))+"個其他字元。"SET TALK ONRETURN
2 # daazhu1
select field1,count(fielld1) as cnt from table1 group by field1
* vfp題:輸入一個字串,統計其中字母、數字、空格和其他字元的個數。SET TALK OFFCLEARACCEPT "請輸入一個字串:" TO _cstringSTORE 0 TO _nzm,_nsz,_nkg,_nqtFOR _i=1 TO LEN(_cstring) _css=SUBSTR(_cstring,_i,1) DO CASE CASE ISALPHA(_css) _nzm=_nzm+1 CASE ISDIGIT(_css) _nsz=_nsz+1 CASE _css=" " _nkg=_nkg+1 OTHERWISE _nqt=_nqt+1 ENDCASEENDFOR?"經統計:字串“"+_cstring+"”中有"?" "+LTRIM(STR(_nzm))+"個字母;"+LTRIM(STR(_nsz))+"個數字;"+LTRIM(STR(_nkg))+"個空格;"+LTRIM(STR(_nzm))+"個其他字元。"SET TALK ONRETURN