I am trying to search an arraylist, not for a value but for a format. I am importing a text file that is inconsistent in formatting. I have successfully imported the information into a 2D arraylist
. Is there a way to scrub the info for a format of a string?
example imported info:
14 03-324-27216|14 "1 = 14' 0"" X 3.500""" 14.000 49 3.500 MF AU 210 AS M 0 05-01-15
14 03-362-50502|14 24543 "1 = 21' 6"" X 3.625""" 21.000 77 3.625 BF GP 212
Location REM
V:24543
Each line of the imported file may contain multiple dimensions and multiple lines. I would like to start a new Arraylist when the format
##-###-#####|##
shows up, and add an element any time that
"# = ##' #"" x #.###"""
show up.
From the two lines you posted it appears that is a space delimited CSV file. The downside is that some 'empty' elements were written as a space.
If you replace spaces with commas (unless they have a space on both sides) you get a properly formatted CSV file.
03-324-27216|14, , ,"1,=,14',0"",X,3.500""",14.000,,49, ,, ,3.500, ,MF,AU,210,AS,M,,0, ,05-01-15, ,,
03-362-50502|14,24543, ,"1,=,21',6"",X,3.625""",21.000,,77, ,, ,3.625, ,BF,GP,212, ,, ,, , ,
It may be easier to build a custom CSV parser that handles the weird 3 spaces in a row case.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.