How to find prefix in a sting

1 view (last 30 days)
cat cat
cat cat on 11 Jan 2016
Commented: Stephen23 on 11 Jan 2016
Hi! I have a vector of strings and I want to find the prefix
Ex 0234567 --> prefix 0
How can I do?

Accepted Answer

Stephen23
Stephen23 on 11 Jan 2016
Edited: Stephen23 on 11 Jan 2016
Use indexing:
>> str = '0234567';
>> str(1)
ans = 0
  2 Comments
Stephen23
Stephen23 on 11 Jan 2016
>> str = '01234567';
>> prf = str(1)
prf = 0
>> pof = str(2:end)
pof = 1234567

Sign in to comment.

More Answers (0)

Categories

Find more on Structures in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!