Change characters in string - Not Exactly C language

1k Views Asked by At

I need to change one character in string. In normal C, this is done simply by changing the offset:

char string[]="Somestring";
string[1] = 'a';   //"Samestring"

But in NXC such operation is not supported. So how do I change charecter on a string offset. NXC documentation about their strings has 3 lines, so I'm quite helpless now.

1

There are 1 best solutions below

2
shea On BEST ANSWER

You can do it like this:

string foo = "Somestring";
foo[2] = 'a'; // results in "Samestring"