필터 지우기
필터 지우기

How to remove a some part of a string from a string?

조회 수: 39 (최근 30일)
vijay chandra
vijay chandra 2017년 9월 14일
댓글: Jan 2017년 9월 15일
Pdus_ENGINE_PKG_ENGINE_ECU_Stat_PT_SENSOR_Container
i want to remove '' engine_pkg_engine_ ''

채택된 답변

Stephen23
Stephen23 2017년 9월 14일
>> 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

추가 답변 (1개)

Akira Agata
Akira Agata 2017년 9월 14일
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
vijay chandra
vijay chandra 2017년 9월 15일
thank u Akira. but Erase is not working. it is showing erase is a undefined function or variable in R2016a.
Jan
Jan 2017년 9월 15일
@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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 String Parsing에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by