Kyleb91
(Kyle Brown)
March 5, 2020, 11:42am
1
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
@Kyleb91
1 Like
"Hi, " +in_FullName like this
@Kyleb91
1 Like
Kyleb91
(Kyle Brown)
March 5, 2020, 12:05pm
4
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
Hey,
so tell me this what does your in_FullName variable has?
@Kyleb91
Kyleb91
(Kyle Brown)
March 5, 2020, 12:11pm
6
in_FullName is “Kyle Brown”
1 Like
so from that you want First Name ??
Kyleb91
(Kyle Brown)
March 5, 2020, 12:12pm
8
Yes,
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+ “,”
@Kyleb91
i hope this helps you, let me know
cheers
Happy Learning.
1 Like
Kyleb91
(Kyle Brown)
March 5, 2020, 12:39pm
10
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?
Kyleb91
(Kyle Brown)
March 5, 2020, 12:44pm
12
a body of text - so:
"Hi,
This is a email text which follows the hi etc…
Many Thanks"
Kyleb91
(Kyle Brown)
March 5, 2020, 1:11pm
13
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.