필터 지우기
필터 지우기

How to remove a part of string from a string. not manually.

조회 수: 2 (최근 30일)
vijay chandra
vijay chandra 2017년 10월 10일
댓글: Image Analyst 2017년 10월 11일

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).

답변 (1개)

Image Analyst
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
vijay chandra
vijay chandra 2017년 10월 11일
I mentioned braces below. but the total string is above one. ok thank you.
Image Analyst
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 CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by