Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting a complex text as a string

abc @cnn("sujsl d(*) sfv @nor dsf ",dn,".",@tn); ator '`,`') sds
@cns1 or '`,"\','\",`') fdhg @cns2 sf \",dn,"; nj

How can I get this text as a string in C#. It can not be simply done due to containing " I would prefer to paste it, someway, as it is, rather than replcaing " with \" as my text already contains things like that

One way is, to paste it in a static text Box (textBox1) and then get it as Text of textbox (If I have to use this in a winform) e.g. string st = textBox1.Text

How this type of text can be got in a string variable without using a textBox?

like image 757
Sami Avatar asked May 19 '26 22:05

Sami


2 Answers

This is a good case for resource files. They will allow you to enter string literals without having to worry about escaping of any kind and are available to you programmatically. See for reference http://msdn.microsoft.com/en-us/library/3xhwfctz(v=vs.100).aspx

like image 143
Reacher Gilt Avatar answered May 21 '26 11:05

Reacher Gilt


Check out string literals, this may be what you are looking for.

like image 24
tnw Avatar answered May 21 '26 12:05

tnw



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!