String

  • Thread starter Thread starter shapper
  • Start date Start date
S

shapper

Hello,

Is there a string function to do something as follows:

My Text becomes <My Text>

Sure I can use MyNewText = "<" & "MyText" & ">".

I was just wondering if there is any function to make things like this.

Thanks,
Miguel
 
Hi Shapper

Equivalent:

string myString = "My Text";
myString = String.Format("<{0}>", myString);
 
shapper said:
Hello,

Is there a string function to do something as follows:

My Text becomes <My Text>

Sure I can use MyNewText = "<" & "MyText" & ">".

I was just wondering if there is any function to make things like this.

Thanks,
Miguel

No, not a simple function, as far as I know.

You can create a HtmlTextWriter that writes to a StringWriter, use the
WriteBeginTag to write the tag to the writer, and finally get the
underlying StringBuilder from the StringWriter and use the ToString
method to get the result as a string.
 
Back
Top