MATLAB Answers

0

HOW I CAN REMOVE THE SPACE

Asked by ahmad abusara on 23 Jun 2019 at 6:48
Latest activity Answered by Walter Roberson
on 23 Jun 2019 at 16:07
how i can remove the spacing from strings like this
i have this string ( STEP NOT OF PETS ) and i want it to be like this ( STEPNOTOFPETS )

  2 Comments

Character vector? Or string() object?
Character vector

Sign in to comment.

Tags

2 Answers

Answer by madhan ravi
on 23 Jun 2019 at 7:05

regexprep(yourstring,' ','')

  1 Comment

madhan ravi
on 23 Jun 2019 at 7:06
Also you could use strrep() in place of regexprep().

Sign in to comment.


Answer by Walter Roberson
on 23 Jun 2019 at 16:07

yourstring(yourstring == ' ') = '' ;

  0 Comments

Sign in to comment.