Removing strings containing numbers

39 Ansichten (letzte 30 Tage)
HIRAKJYOTI BASUMATARY
HIRAKJYOTI BASUMATARY am 19 Jan. 2018
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.

Akzeptierte Antwort

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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Birthdays finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by