I have a code that can solve your problem given that every string is a string array for c# we can do it here:
var teste = "customer.presentAddress.streetName".Split(".");
List<string> result = new List<string>();
foreach (var x in teste)
{
result.Add(string.Concat(x[0].ToString().ToUpper(), x.AsSpan(1)));
}
Console.WriteLine(String.Join(".", result));
I converted it to a static method so you can use it wherever you need:
public static class ConvertPatternString
{
public static string ToPascalCase(this string value) =>
value switch
{
null => throw new ArgumentNullException(nameof(value)),
"" => throw new ArgumentException($"{nameof(value)} cannot be empty", nameof(value)),
_ => string.Concat(value[0].ToString().ToUpper(), value.AsSpan(1))
};
public static string ToPascalCaseWithSeparator(this string value, string separator) =>
value switch
{
null => throw new ArgumentNullException(nameof(value)),
"" => throw new ArgumentException($"{nameof(value)} cannot be empty", nameof(value)),
_ => string.Join(separator, value.Split(separator).Select(x => string.Concat(x[0].ToString().ToUpper(), x.AsSpan(1))))
};
}
to use just do:
Console.WriteLine("customer.presentAddress.streetName".ToPascalCaseWithSeparator("."));