What's the best way of parsing a fixed-width formatted file in Java?
问题 I\'ve got a file from a vendor that has 115 fixed-width fields per line. What\'s the best way of parsing that file into the 115 fields so I can use them in my code? My first thought is just to make constants for each field like NAME_START_POSITION and NAME_LENGTH and using substring . That just seems ugly so I\'m curious if there\'s any other recommended ways of doing this. None of the couple of libraries a Google search turned up seemed any better either. Thanks 回答1: I would use a flat file