How to divide by space keeping words with spaces inside quotes?

Marcone marcone at email.com
Mon Aug 9 14:37:28 UTC 2021


Thank you very much! With your helps I created this function that 
works fine:

     // Function splitcommas()
     string[] splitcommas(string text) nothrow {
     	try {
     		return 
text.splitter!(Yes.keepSeparators)(regex("[^\\s\"']+|\"([^\"]*)\"|'([^']*)'")).array.map!(x => x.replace("\"", "")).filter!(x => x.strip.length).array;
     	} catch(Throwable){ return []; }
     }


More information about the Digitalmars-d-learn mailing list