SetAt() method in Net like CString class.

G

Guest

Hello all.

Is there something similar to this in NET?

CString s( "abcdef");
s.SetAt(1, 'a');

I am looking for a method in the String class but I do not see anything.

Thanks in anticipation.
 
B

Ben Voigt

Tomas said:
Hello all.

Is there something similar to this in NET?

CString s( "abcdef");
s.SetAt(1, 'a');

I am looking for a method in the String class but I do not see anything.

..NET strings are immutable. This is so they can be copied by making a
second pointer to the same memory, instead of duplicating the content.

To set individual characters, use a System::Char[] instead. There is a
System::String::ToCharArray() method and overloaded String constructor to
make converting back and forth easy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top