My current task is to create a (programming) algorithm which reverts a name's order. This since my country's formal name-listing order is different from international ones. The standard is often:
However, the standard I must comply to has the following priority:
Our businesses often receives names in the international style, which needs to be converted to our national style.
However, I've yet to come up with a way to deal with double names and similar cases. As an example, how to convert the following name?
John Foo Doe => Doe, John Foo / Doe, Foo John
I'm appreciating all input on this broad question. Please list possible problems (and preferably its solution), or perhaps a project which has faced this problem before.