How to cut the end of a string which follows a special character?
古いコメントを表示
For example: 'sahdklsjf_sdfs' to 'sahdklsjf'
2 件のコメント
Mr M.
2015 年 5 月 26 日
David Young
2015 年 5 月 26 日
mfilename is a function, so it can't be indexed. Assigning its result to a variable then gives you a string which can be indexed.
回答 (3 件)
Jan
2015 年 5 月 26 日
S = 'sahdklsjf_sdfs'
Part = strtok(S, '_');
Thorsten
2015 年 5 月 26 日
regexp('sahdklsjf_sdfs', '(^[a-zA-Z]*)', 'match')
Jos (10584)
2015 年 5 月 26 日
Many options, including:
str = 'sahdklsjf_sdfs'
out1 = str(1:find([str '_']=='_',1,'first'))
Also take a look at TEXTSCAN
カテゴリ
ヘルプ センター および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!