Click here to Skip to main content
15,894,330 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
hi people i have a problem

i have a text file that is padded into columns using white spaces

i want to know how can i define the delimiter in the

MSIL
DataSet ds = TextToDataSet.Convert("c:\test.txt", "MyNewTable", "????????");


so that the delimiter takes all the white spaces between the columns as a delimiter

the problem now is the white spaces isn't all the same amount of spaces

every row in the file has different amount of spaces

can anyone assist me please

the ?????? is what i1m looking for the \t doesn't work the "\s*" doesn't work tried to create a regex but doesn't work either?

i need a delimiter to ignore all the white spaces between data

and the amount of white spaces aren't the same in each row row one has like lets say 5 and row 2 has like 10 or 20 between the data so now i need to know how to define that delimiter so that it uses any amount of white spaces as the delimiter?
Posted
Updated 21-Jan-10 0:09am
v6

If you are referring to this article, I suggest you ask the author in the forum at the bottom of article.
 
Share this answer
 
You could try something like this before doing anything with the data:

string myString = "a    b      c";
do
{
   myString = myString.Replace("  ", " ");
}
while (myString.IndexOf("  " >= 0);
myString = myString.Trim();
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900