以下是引用ycvf在2021-4-1 17:44:23的发言:
这个函数GETWORDNUM(jmss1, lnj, ",")没见过,有知道的吗、
这个函数GETWORDNUM(jmss1, lnj, ",")没见过,有知道的吗、
VFP9 版本中的一个函数,大体意思:从一个字符串中返回指定单词。
坚守VFP最后的阵地
[此贴子已经被作者于2021-4-1 18:34编辑过]
DIMENSION az[100] USE sp t1 = SECONDS() n = GETWORDCOUNT(jmss1, ",") FOR i=1 TO n STORE 0 TO az SCAN j = (VAL(GETWORDNUM(jmss1,i,","))+1) * 10 az[j] = az[j]+1 ENDSCAN ENDFOR ? SECONDS() - t1 FOR i=1 TO 100 IF az[i] > 0 ? i/10-1, az[i] ENDIF ENDFOR
T1 = SECONDS() CLOSE DATABASES USE 选择\sp ALIAS aa ln = OCCURS(",", jmss1) + 1 && 获取题目的数量 FOR lnj = 1 TO ln lnCnt = 0 RELEASE la LOCAL la[10, 2] SCAN lnfz = VAL(GETWORDNUM(jmss1, lnj, ",")) &&VAL(SUBSTR(jmss1, 2 *lnj - 1, 1)) IF ASCAN(la, lnfz, 1, ALEN(la, 1), 1) = 0 lnCnt = lnCnt + 1 la[lnCnt, 1] = lnfz la[lnCnt, 2] = 1 ELSE lnRow = (ASCAN(la, lnfz, 1, ALEN(la, 1), 1) + 1) / 2 la[lnRow, 2] = la[lnRow, 2] + 1 ENDIF ENDSCAN ENDFOR MESSAGEBOX(SECONDS() - T1) FOR lnj = 1 TO ALEN(la, 1) IF ASCAN(la, .F., 1, ALEN(la, 1), 1) > 0 lnCnt = (ASCAN(la, .F., 1, ALEN(la, 1), 1) + 1) / 2 EXIT ENDIF ENDFOR DIMENSION la(lnCnt - 1, 2) ASORT(la) LIST MEMORY LIKE la && 最后一题的数组结果
[此贴子已经被作者于2021-4-1 21:26编辑过]