輸入字符串是:將一個字符串分解成兩個部分在MATLAB
InputStr1 = 'this-is-a-boy-5';
InputStr2 = 'this23-is-a-boy-10';
InputStr3 = 'this-41';
輸出應該是:
Output1 = ['this-is-a-boy'] [5]
Output2 = ['this23-is-a-boy'] [10]
Output3 = ['this'] [41]
我想這些字符串分成兩個部分,這樣我可以第一個字符串分隔和最後一個號碼。我試過strsplit()
但它沒有幫助。
什麼你的正則表達式?同時發佈您的代碼。 –