How to format the string

Example

Name: {Name}

Email: {Email Address}

Phone Number: {Phone Number}
in your email template

how to make the name, email, phno to fill in that particular area.

Name: Mani

Email: mani@gmail.com

Phone number: *****

2 Likes

Hi @Mani_Mani

Kindly follow the below steps that could help you solve this issue

–First store this string template in a text file

Name: {0}

Email: {1}

Phone Number: {3}

where 0, 1, 2 are the place holders where we are going to mention the string that is to be placed in 0, 1, 2
–and use read text file activity and pass the file path of the text file and get the output with a variable of type string named out_text

–then in the body mention as String.Format(out_text,“Mani”,“mani@gmail.com”,“1234123515”)
and the actual syntax is
String.Format(“{0} {1} {2} …”, “value1”,“value2”,“value3”)
where {0}{1} are already in our output variable obtained from read text file activity and value1, value2 and value3 are passed as string between quotes if they are values or if we have those values in variables then we can mention the variable name alone without double quotes around them like this
String.Format(“{0} {1} {2} …”, variablename1,variablename2,variablename3)

Hope this would help you
Kindly try this and let know for any queries or clarificaiton @Mani_Mani
Cheers

5 Likes

Is this the only way?

Can we store the template in this format and make it work
Name: {Name}

Email: {Email Address}

Phone Number: {Phone Number}

1 Like

Buddy @Mani_Mani actually we need to mention the place holder as index which should be a integer value and not a string, so we cannot mention the {Name}, {Email Address}, {Phone Number}, instead with integers like {0},{1},{2}

Cheers @Mani_Mani

2 Likes

Thank you so much

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