Returning Individual CSV Values* Write a function named next String that will return a single ' value ' ( i. substring ) from a Comma Sepa - rated...
This is a C++ problem. Please give full explanations and code in details. Thanks.
1 ) . Returning Individual CSV Values*Write a function named next String that will return a single ' value ' ( i.e. substring ) from a Comma Sepa -rated Value " string . Your function will take two arguments : a string variable containing a comma separatedlist of values , and an integer containing the starting index ; your function should return a single string objectwith the value that starts at that index and ends right before the next comma' ,' ( do not include the comma inthe returned string ! ) :`string nextString ( string str , int startIndex ) ;If , however , the start index is after the last comma in the string , then the function should return the value start -ing at that index and continuing to the end of the string .For example ,cout < < next String ( " my , cat , ate , my , homework " , 3 ) ;will printcatandcout < < nextString ( " my , cat , ate , my , homework " , 8 ) ;will printteandcout < < nextString ( " my , cat , ate , my , homework " , 18 ) ;will printworkWhen you have written your function , then write a short test program that will take in a simple comma sepa -rated string using getline :"getline ( cin , somestring )and output values in the string using the next String function .2 ) . Split*Now , extend your test program by adding a second function named sp 1 it that will identify all the individualvalues in a comma separated value string and return them in an array of string objects :"int split ( string str , string a [ ] , int maxsize ) ;Your function will take three arguments : a comma separated value string str , an array a of string objects .and the maximum size of the array . You must use the next String function from Stretch Problem ( 1 ) toobtain each value in the string and store it in the array starting , with the first element . Return the total numberof values stored in the array .For example :"string varray [ VALUES ] ;int ent = split (" my , cat , ate , my , homework " , varray , VALUES ) ;Forl int 1 = 0 ; i<ont ; it + )cout < < Varray [ 1 ]`< < endl ;
Show more