How to remove characters from a string

  • Follow


Forgive me if this question has already been answered. I was not able to find it. 

I need to modify a string being used in a loop. 

string = { 'the table' }

remove 'the'
so that 

newString = { 'table' }

How can I do this?

Thanks for the help!
0
Reply Donovan 5/13/2010 10:44:06 PM

On May 14, 12:44=A0am, "Donovan " <creekm...@gmail.com> wrote:
> Forgive me if this question has already been answered. I was not able to =
find it.
>
> I need to modify a string being used in a loop.
>
> string =3D { 'the table' }
>
> remove 'the'
> so that
>
> newString =3D { 'table' }
>
> How can I do this?
>
> Thanks for the help!

one of the solutions
- note: you create a CELLSTR var

     s=3D{'the table'};
     r=3Dstrrep(s,'the ','')
%    r =3D 'table'     % <- a CELLSTR
% see also: regexprep

us
0
Reply us 5/13/2010 10:48:33 PM


Or, to make it LESS general, but simpler:

string = { 'the table' };
Newstring = {string{1}(5:end)}
0
Reply Matt 5/13/2010 10:54:05 PM

Worked perfectly, thank you!
0
Reply Donovan 5/14/2010 9:14:04 AM

3 Replies
2098 Views

(page loaded in 0.002 seconds)

Similiar Articles:













7/23/2012 7:09:58 AM


Reply: