How to remove a part of string from a string. not manually.
1 回表示 (過去 30 日間)
古いコメントを表示
Pdus_ENGINE_PKG_ENGINE_CPC_ENGINE_COM01_Container_ST3
I need Pdus only. I want to remove remaining part which is inside braces from the above string.i dont want to remove it manually by considering the remaining part.i need it in some other way.
(_ENGINE_PKG_ENGINE_CPC_ENGINE_COM01_Container_ST3).
0 件のコメント
回答 (1 件)
Image Analyst
2017 年 10 月 10 日
Here's one way:
str = str(1:4); % Extract only the first 4 characters.
If that doesn't do it, then say why not.
By the way, the "above string" doesn't have braces in it.
2 件のコメント
Image Analyst
2017 年 10 月 11 日
You can get rid of braces first like this
str = strrep(str, '{', '');
str = strrep(str, '}', '');
str = str(1:4); % Extract only the first 4 characters.
参考
カテゴリ
Help Center および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!