Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best way to parse fixed length text file
Message
De
28/04/2009 09:32:01
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
 
 
À
28/04/2009 09:14:44
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
01396650
Message ID:
01396661
Vues:
83
>>Hi All, I need to parse a text file which contains fixed length lines of six columns like the one shown below, however, one or more of the columns could be blank - the only constant being the first which always there and is of the format with BX00000000 - I've cobbled a program together which uses substrings, but think a Regex would be a cleaner way ?
>>
>>
>>
>>  
>>BX00027025  AD               ME                CW                   NO'S ALLOCATED TO KEW TRUNKS   29/03/1994 
>>
>>
>
>Pete,
>
>If the lines are fixed length (and hence the columns), then I would keep the substr. I do not see any need for a Regex in this case

I agree. IIRC RegEx is somewhat of an expensive operation when compared to regular string manipulation.
Very fitting: http://xkcd.com/386/
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform