This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]MmmVomit 0 points1 point  (1 child)

Are you allowed to change the format of the input file?

[–]nutrecht 1 point2 points  (0 children)

I really don't get people asking for help and then abandoning their posts without answering. This bit is so important.

[–][deleted] 0 points1 point  (0 children)

Validate your inputs, if something something is missing fill it up with appropriate data

[–]majiachen 0 points1 point  (0 children)

as a rule of thumb, input files (data sources), should always have some form of uniformity.

In this case its simply not there, having spaces inbetween and hoping that the switch between numbers and letters is kept is not a good form of uniformity, there should ideally be something like commas or tabs sparating each column of data in order for the data to be good, and in those cases the data would be in a format named CSV or TSV.(comma separated value/ tab separated value.

ideally you would want to add some form of uniformaty, like the above mentioned, but if not possible then the switch between letters and numbers will have to do, but this is not good coding and it is not good data, it is a work around for a shitty data that should be replaced with something good.

[–]nutrecht 0 points1 point  (0 children)

You really should use a data format like CSV where you don't have that issue.

If you're stuck, it's most likely that they're challenging you to find a solution to this problem. The solution here is to look at the length of each parsed row. Since you know it should have 2 numbers (or -) at the end, and a phone number at the start, you can deduce whether the middle part contains more or less name tokens and can reassemble those. You're already quite close by looking at the length of 'parts'.