Replacing or splitting words

I want to replace a name like Ruben with R. How can i realise this.
So if the name is Stan i need S.

You can use assign activity as

NewName = OldName.substring(0,1)

0 is the starting index and 1 is the length.

Then another assign activity as
OldName = NewName simply or you can use replace method available already to replace

Here is the code:

    Dim OldName As String = "Hareesh"
    Dim NewName As String = OldName.Substring(0, 1)
    OldName = NewName
1 Like

Hi @438654

You can do this by using two assign activities.

Gets the first name of the name

Gets the first letter of the first name
image

Let know whether this helps to get your task done…

2 Likes

Doesn’t work. The name is read from excel. So Ruben is read from excel and must be R.

Buddy @438654

Great…

  1. Open the excel application scope to open the excel
  2. use read range activity to read the sheet where you have the value Ruben or any othernames
  3. Assign that read range activity output to a variable of type datatable named out_dt
    4.Use for each row loop to iterate through each row in datatable
  4. Use a assign activity to get the first character of the name in first row and first column (can change as per your document)
    out_name = row(“ColumnName”).substring(0,1).ToString
  5. Again use assign activity to change the name from Ruben to R like
    row(“samecolumnname”) = out_name
  6. Thats all buddy, you are all done

Hope this would help you

Cheers.

1 Like

In case its coming from excel, then use the approach mentioned by @Palaniyappan… it will work

2 Likes

Thank you very much

1 Like

@438654
@Lahiru.Fernando

Cheers…Buddy…Keep going

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.