Insert Text into a body and Re-enter

Hi Guys,

I have a body of text in form of a string, but I want to now assign to include a name after the work “Hi,” but to also include the comma after the name now.

Could you help me form the code - I currently have an assign activity with the following:

New_Str = email_Text.Replace(“Hi,”,“Hi “+in_FullName.Substring(” “,(0))+”,”

So I want to set the new string to include the Name, but only the first name - As ‘in_FullName’ contains First and Last name.

Could you please help me form the above, as the code above returns errors.

Many Thanks!

1 Like

your variable in_FullName = kyle brow
you want it like Hi, kyle Brown

1 Like


"Hi, " +in_FullName like this

1 Like

Hi Yes, so I want the substring so just “Kyle” and then add this to the email string after “Hi” but before the comma - The first line of the email text is “Hi,”

So I want the new text to read “Hi Kyle,” and then use the rest of the string.

1 Like


so tell me this what does your in_FullName variable has?

in_FullName is “Kyle Brown”

1 Like

so from that you want First Name??


I was trying to combine all in the one assign activity:

New_Str = email_Text.Replace(“Hi,”,“Hi “+in_FullName.Substring(” “,(0))+”,”

1 Like

FirstName =in_FullName.Split({" "},stringSplitOptions.RemoveEmptyEntries)(0) this will give you Kyle

you can do this "Hi " +FirstName+ “,”

i hope this helps you, let me know
Happy Learning.

1 Like

Thanks man - so would

Newstr = email_Text.Replace(“Hi,”,“Hi “+in_FullName.Split({” “},stringSplitOptions.RemoveEmptyEntries)(0)+”,”)

Still return the rest of the email after the Hi Kyle,?

1 Like

what does your email_text contains?

a body of text - so:


This is a email text which follows the hi etc…

Many Thanks"

It does re the above thanks!

Is there a way of keeping the original formatting of the email, as I am now left with a block of Text, not in email format.