Question: How to write matlab function for this problem? Character string parsing is the operation of splitting apart strings of text into useful segments that a

How to write matlab function for this problem?  How to write matlab function for this problem? Character string parsing

Character string parsing is the operation of splitting apart strings of text into useful segments that a computer can make use of. Character string parsing is often useful to interpret textual input read from a file or typed by a user. Character string parsing is analogous to splitting apart a sentence into each of its component words. The characters used to separate distinct expressions from one another are called delimiters. Examples of common delimiters are the space character and the newline character. _string is a (possibly empty) row vector of class char. _delimiters is a row vector of class char, which contains at least one value, and where each character is a distinct delimiter. _delimiter is a 1 by 1 array of class char whose value should be the _rst delimiter (among the delimiters by delimiters) that appears in string. _left is a row vector of class char whose value is the part of string located to the left of the _rst delimiter that appears in string (excluding the delimiter itself). _ right is a row vector of class char whose value is the part of string located to the right of the _rst delimiter that appears in string (excluding the delimiter itself). If none of the delimiters specie by delimiters are present in string, then left should have the value of string, and both right and delimiter should be empty character strings. It is possible for string to start with one of the delimiters. In this case, left should be an empty character string. You may not use Matla's built-in functions split. strsplit, find, and str find in this question. Test cases: >> [delimiter, left, right] = my parser('Hi+Everybody', '+') delimiter = + left = Hi right = Everybody

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!