How to Parse and Validate a Full Name in C# .NET Framework

Cloudmersive
2 min readJul 14, 2020

--

Parsing a person’s name is actually quite a difficult task for a computer. There are a ton of different pieces that can make up someone’s full name, including titles, nicknames, and middle names to name a few. Trying to account for all of these reliably is a chore of the Nth degree. Today I will be giving you the keys (terrible pun!) to an API that can deal with this for us!

First we shall download our package using NuGet.

Install-Package Cloudmersive.APIClient.NET.Validate -Version 3.0.6

Now this little bit of code here can be used for calling our name validation function:

using System;using System.Diagnostics;using Cloudmersive.APIClient.NET.Validate.Api;using Cloudmersive.APIClient.NET.Validate.Client;using Cloudmersive.APIClient.NET.Validate.Model;namespace Example{public class NameValidateFullNameExample{public void main(){// Configure API key authorization: ApikeyConfiguration.Default.AddApiKey("Apikey", "YOUR_API_KEY");// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed// Configuration.Default.AddApiKeyPrefix("Apikey", "Bearer");var apiInstance = new NameApi();var input = new FullNameValidationRequest(); // FullNameValidationRequest | Validation request informationtry{// Parse and validate a full nameFullNameValidationResponse result = apiInstance.NameValidateFullName(input);Debug.WriteLine(result);}catch (Exception e){Debug.Print("Exception when calling NameApi.NameValidateFullName: " + e.Message );}}}}

And would you look at that? We’re already done.

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

No responses yet