Problem 2073. Split a given string from the first instance of a given character
A simple operation to split a given string into two substrings at the point where the desired character is first found. e.g.
inputString: 'we have 6 cars' split it from '6'
output: 'we have ' and '6 cars'
If the desired character is not found then first substring is same as the whole string and the second string is empty string, i.e. y2='';
Solution Stats
Problem Comments
-
3 Comments
Marcel
on 6 Jan 2014
how about adding some test cases with multiple occurances of the divider?
Mehmet E. Yavuz
on 7 Jan 2014
Thanks, good idea
goc3
on 31 May 2017
Additional test cases have been added.
Solution Comments
Show commentsProblem Recent Solvers119
Suggested Problems
-
280 Solvers
-
1734 Solvers
-
Construct an index vector from two input vectors in vectorized fashion
442 Solvers
-
Generate a random matrix A of (1,-1)
393 Solvers
-
17333 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!