Assuming your value(name) you get is in Proper Case format (first letter is capital for e.g like this MarisaOntiveros or Marisa Ontiveros).
Assign this code to a String Datatype variable
Strrr.Select(Function(r) If(System.Text.RegularExpressions.Regex.IsMatch(Strrr,"(?=[A-Z])\B\w+")=True,System.Text.RegularExpressions.Regex.Match(Strrr,"(?=[A-Z])\B\w+").ToString+","+System.Text.RegularExpressions.Regex.Match(Strrr,"(?=[A-Z])\w+(?=[A-Z])").ToString,String.Join(",",System.Text.RegularExpressions.Regex.Matches(Strrr,"\w+").Cast(Of match).Reverse) ) )(0)
- here Strrr is my string variable replace it with your’s
using this code it’ll check the what kind of name we have whether is has space in between or composed and
if its composed then my Regex pattern will get the two values based on the Captial letters of each word and then it’ll rearrange the order and also add a comma to it.
If it has space in between it’ll just get the two words using regex and reverse the order and add a comma.In the end (0) is to get the first value as we had split it using each character.
Check this workflow for better understanding
marisa.zip (12.9 KB)