It seems that you want to put the first word at the end of what is returned. So, you can:
public static string NomeAutor(string autor) {
if(autor.Trim() == "") return "";
string nomeCompletoRetornado = autor;
string primeiroNome = nomeCompletoRetornado.Split(new char[] {' ', ','})[0].Trim();
string resto = nomeCompletoRetornado.Substring(
primeiroNome.Length + 1,
nomeCompletoRetornado.Length - primeiroNome.Length - 1).Trim();
string resultadoFinal = resto + " " + primeiroNome + ".";
return resultadoFinal;
}
Use:
NomeAutor("Bragança, Luiz Philippe De Orleans E") => "Luiz Philippe De Orleans E Bragança."
NomeAutor("José, Fino de Souza Pereira") => "Fino de Souza Pereira José."
See working on .NET Fiddle.
This will take the full name, get the first name before the ',' or ' ', remove from the original name the size of what was obtained from the first result and briefly concatenate it at the end.
That one
namecomesBragança, Luiz Philippe De Orleans E?– Felipe Avelar
Hello Felipe, yes this way, and I need how to read the author "Luiz Philippe De Orleans E Bragança"
– WeberSP