assume text is the entire value you have
First u need to get the string from csv file as a table.
use trim function to trim the string then update it in table or write it in another csv file.
Refer this for trim function
For spliting refer this