How to remove a some part of a string from a string?
103 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
vijay chandra
am 14 Sep. 2017
Kommentiert: Jan
am 15 Sep. 2017
Pdus_ENGINE_PKG_ENGINE_ECU_Stat_PT_SENSOR_Container
i want to remove '' engine_pkg_engine_ ''
0 Kommentare
Akzeptierte Antwort
Stephen23
am 14 Sep. 2017
>> str = 'Pdus_ENGINE_PKG_ENGINE_ECU_Stat_PT_SENSOR_Container';
>> regexprep(str,'engine_pkg_engine_','','ignorecase')
ans =
Pdus_ECU_Stat_PT_SENSOR_Container
or
>> strrep(str,'ENGINE_PKG_ENGINE_','')
ans =
Pdus_ECU_Stat_PT_SENSOR_Container
Weitere Antworten (1)
Akira Agata
am 14 Sep. 2017
If your MATLAB is R2016b or later version, you can use erase function, like:
>> str = 'Pdus_ENGINE_PKG_ENGINE_ECU_Stat_PT_SENSOR_Container';
>> erase(str, 'ENGINE_PKG_ENGINE_')
ans =
Pdus_ECU_Stat_PT_SENSOR_Container
2 Kommentare
Jan
am 15 Sep. 2017
@GADIDHIMI SAI KUMAR BABU: Did you see Akira's hint: "If your MATLAB is R2016b or later version ..."? erase works with the modern string class only.
Siehe auch
Kategorien
Mehr zu Software Development Tools finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!