我有一個函數從一個匹配特定字符串的表中返回案例。 一旦我得到所有匹配這些字符串的案例,我需要搜索每個案例(這是它自己的列表)爲特定的字符串,並執行一個命令。但我知道該怎麼做才能將整個列表的大列表變成一個字符串,然後我只得到一個結果(當我需要每個案例的結果時)。Mathematica - 列表中的StringMatch元素?
[email protected];
EncodeTable[id_?PersonnelQ, f___] :=
Cases[#,
x_List /;
MemberQ[x,
s_String /;
StringMatchQ[
s, ("*ah*" | "*bh*" | "*gh*" | "*kf*" |
"*mn*"), IgnoreCase -> True]], {1}] &@
Cases[MemoizeTable["PersonnelTable.txt"], {_, id, __}]
該函數從
Which[(StringMatchQ[
[email protected]
EncodeTable[11282], ("*bh*" | "*ah*" |
"*gh*"), IgnoreCase -> True]) == True, 1,
(StringMatchQ[
[email protected]
EncodeTable[11282], ("*bh*" | "*ah*" |
"*gh*"), IgnoreCase -> True]) == False, 0]
該函數應該返回1或0由第一函數返回每種情況下表返回的情況下,但我不知道如何搜索在列表中不使它們全部爲一個字符串並返回每個列表的結果。
{ {204424,11111,SQLDateTime [{1989,4,4,0,0,0}},Null, 「Parthom,Mary,MP」,Null,4147, 「T-00010 AH BH UI」,{ T-00010 AH BH U I」, 「M-14007 LL GG」, 「F-Y3710 AH LL UI GG」}, 「移除。」},{2040,11111, SQLDATETIME [{1989,4,13,0,1, 0。}],Null,「KEVIN,Stevens,STK」, Null,81238, 「T-00010 ah gh mn」,{「T-00010 mn」, 「M-00100 dd」,「P-02320 sd」 , 「M-14003 ed」,「T-Y8800 kf」, kj「}} – Rosie
這將是第一個函數返回的小樣本列表,我只需要每個最後一個結果,以便樣本應該返回兩個結果(例如「1,1」) – Rosie
謝謝!有沒有辦法在多個元素上執行StringMatchQ?像{8,9}? – Rosie