On Mon, Oct 13, 2014 at 5:29 AM, Baltasar García Perez-Schofield < baltas...@gmail.com> wrote:
> > > Hi, > > >Please tell me how I would go about incorporating hex 0x02 and 0x03, Start > >Of Text and End of Text, into a string in C#. > >In C i would sprintf it but have as yet not found an equivalent in C#. > >In fact from the reading I have done I am no longer sure that C# can > >handle hex. > > You can use string.format. Instead of %s or %d, you use {0} or > {1}, being that the position of the value in the data list. For example: > > string str = "..."; > string final = string.Format( "{0}{1}{2}", 0x02, str, 0x03 ); > > string.Format: > http://msdn.microsoft.com/en-us/library/b1csw23d(v=vs.110).aspx > > format string: > http://msdn.microsoft.com/en-us/library/txafckwd(v=vs.110).aspx > > -- > Baltasar (baltas...@gmail.com http://baltasarq.info/) > _______________________________________________ > Mono-list maillist - Mono-list@lists.ximian.com > http://lists.ximian.com/mailman/listinfo/mono-list > I've found this page (http://blog.stevex.net/string-formatting-in-csharp/) to be a good resource over the years if you want to learn more about the different formatting options in a bit more user friendly manner. slide -- Website: http://earl-of-code.com
_______________________________________________ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list