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에서 String Parsing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!