Transcribe a name correctly

Hello, I need to make a modification to a bank that I am creating. I downloaded a TXT directly from SAP and there is a name column where you can find abbreviated names and the site where I need to fill in the names, it can’t have abbreviation. How do I make Uipath read each row of the name column and all the names that I have abbreviated and leave it only with the full name?

Example:

Original TXT :
Alana B. Santos
Carlos C Costa
Fernanda A. Garcia

New database:
Alana Santos
Carlos Costa
Fernanda Garcia

1 Like

Hey @Hendrix_Santos

So you want to take first name and last name & remove the initials which is what you are looking for ?

Thanks
#nK

1 Like

Yes, I want the names without the initials

1 Like

Hey @Hendrix_Santos

So to identify initials - will it be a single letter with dot or ?

Kindly let me know the rules ?

Thanks
#nK

The initials are usually followed by . or , and can also be just the initial letter without accompaniment

1 Like

Okay @Hendrix_Santos

So multiple letters possible ?

If yes, also please mention pattern for the same !

Thanks
#nK

TXT Original:
Alana B. Santos
Carlos C, Costa
Fernanda A. Garcia
Fernando X. Pereira

1 Like

Hey @Hendrix_Santos

I’m assuming you are getting the text file content as a string with the names right or a datatable ?

The confirmation on the above will help me to write code accordingly…

Thanks
#nK

Yes, these names are being generated by a txt file, I used the activity of reading a txt file to create a database inside the Uipath. I will probably have to use a for each to read all the lines of the name column and if I find a name with only the initial, I will have to remove the initials and leave only the full name

This would be the original file:

Alana B. Santos
Carlos C, Costa
Fernanda A. Garcia
Fernando X. Pereira

His transformation would be:

Alana Santos
Carlos Costa
Fernanda Garcia
Fernando Pereira

1 Like

In excel, if I click find and replace and in the replace option I put the code ( *, ), it can already remove the initials and leave only the full name, it’s very simple.
But I didn’t want to use excel for that and I believe there’s a way to do this process directly in UiPath in the database

1 Like

1 Like

Hey @Hendrix_Santos

Okay cool, thanks for your patience in explaining me things.

So assuming you read the text file and store it in a string str_Names

arrayUpdatedNames = str_Names.Split(Environment.Newline.ToCharArray, StringSplitOptions.RemoveEmptyEntries).Select(Function(line) String.Join(" x, System.Text.Regex.Matches(line, "\w[^\W]+").Select(Function(match) match.Value.Trim))).ToArray

The above statement can be used in an Assign activity. Towards the left just create a new String Array variable and to the right just use the query statement.

Hope this helps.

Thanks
#nK

Thank you very much for giving me a vision about this code, soon I will try to run the same and anything I will return my contact here in this post. Good afternoon and all the best to you.

1 Like

Cool @Hendrix_Santos Anytime !

What programming language would that be?

arrayUpdatedNames = str_Names.Split(Environment.Newline.ToCharArray, StringSplitOptions.RemoveEmptyEntries).Select(Function(line) String.Join(" x, System.Text.Regex.Matches(line, “\w[^\W]+”).Select(Function(match) match.Value.Trim))).ToArray

1 Like

Hey @Hendrix_Santos

It’s VB.NET

Thanks
#nK

1 Like