Removing strings containing numbers

조회 수: 8 (최근 30일)
HIRAKJYOTI BASUMATARY
HIRAKJYOTI BASUMATARY 2018년 1월 19일
댓글: HIRAKJYOTI BASUMATARY 2018년 1월 19일
If i have a string =
" 30th Birthday WORLDCUP34 WORLDCUP'34 '04 "
and i want the output to be only =
" Birthday " ,
then how can i go forward to achieve such by removing all expressions containing numbers with it.

채택된 답변

Birdman
Birdman 2018년 1월 19일
편집: Birdman 2018년 1월 19일
One approach:
s1="30th Birthday WORLDCUP34 WORLDCUP'34 '04";
str=strsplit(s1,' ');
result=str(cellfun(@isempty,(regexp(str,'\d+'))))
  댓글 수: 5
Birdman
Birdman 2018년 1월 19일
Ok Jan, thanks. It just takes time to get used to working with cellfun.
HIRAKJYOTI BASUMATARY
HIRAKJYOTI BASUMATARY 2018년 1월 19일
@Birdman Sir and @Jan Simon Sir , thanks a lot for the guidance. Yes @Jan simon sir, i meant in a single cell.

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by