Click here to Skip to main content
15,919,358 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello ALL,

I have to append <STX> character to string.How shall i do these?
[EDIT]STX is a special character. (http://en.wikipedia.org/wiki/Control_character) [/EDIT]

Thanks and Regards
Posted
Updated 9-Sep-11 0:24am
v6

How much did you read or search yourself?

Adding to strings or putting string together is called 'concatenation' in case you need it again. A simple 'STX character' in google gave me the hex value. (An elaboration on the fact that this is a special code could have been helpful, I first thought you meant to add a tag "<STX>")

To answer your question.
I think the following should do the trick or at least get you on the way:
int stxval = 0x02; //found this value on wikipedia
string mystring;

StringBuilder builder = new StringBuilder(mystring);
mystring.Append(stxval);


I found the hex value here[^]

hope this helps.
 
Share this answer
 
Comments
yeshgowda 9-Sep-11 6:12am    
I have tried this 2gets appended with the string.(i.e <stx> character) this should get appended with string how shall i do this?
V. 9-Sep-11 6:54am    
that is what the solution does. Call the ToString() method on the StringBuilder object to get the string out.
manjulac 9-Sep-11 6:29am    
int stxval = 0x02; //found this value on wikipedia
string mystring="Hello";

StringBuilder builder = new StringBuilder(mystring);
builder.Append((char)stxval);

It works
V. 9-Sep-11 6:53am    
Thanks,please mark the question as solved then :-)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900