Splitting the string using regular expression or string split

7 ビュー (過去 30 日間)
Gopalakrishnan venkatesan
Gopalakrishnan venkatesan 2015 年 5 月 5 日
'a_bb_ccc_ddd_eeeeee_ffff_gg_h_i'
I have a string like this.
I need to split the string as
a_bb_ccc
ddd_eeeeeee
ffff_gg_h_i
how to use the regular expression or stringsplit in order to get the above output?
  3 件のコメント
Gopalakrishnan venkatesan
Gopalakrishnan venkatesan 2015 年 5 月 5 日
i need to split after third underscore and then after fifth underscore
Gopalakrishnan venkatesan
Gopalakrishnan venkatesan 2015 年 5 月 5 日
thanks in advance

サインインしてコメントする。

採用された回答

Jan
Jan 2015 年 5 月 5 日
s = 'a_bb_ccc_ddd_eeeeee_ffff_gg_h_i'
index = strfind(s, '_');
parts = {s(1:index(3)-1), s(index(3)+1:index(5)-1), s(index(5)+1:end)}
  1 件のコメント
Gopalakrishnan venkatesan
Gopalakrishnan venkatesan 2015 年 5 月 5 日
編集済み: Gopalakrishnan venkatesan 2015 年 5 月 5 日
Thats great. Thanks a lot. is it possible to do with regular expression

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by