Search and relapsed multiple characters

Hi

I tried the code from Andy Brown, but i wont work fir me the problem is i think that i want to replace "80" with "1B1F" and it seems to mee that in my case it will nok be an efficient way to it like that, so do some buddy now how i do this in the best way?
I have to look through i array of char and search for 5 different character as you see below and relapse them if they curs
Like if i find "80" it has to be relapsed with "1B7F"
and "40" [ch8594] "1BBF"

Jesper

80h [ch8594] 1Bh, 7Fh = 1Bh, NOT(80h)
40h [ch8594] 1Bh, BFh = 1Bh, NOT(40h)
0Dh [ch8594] 1Bh, F2h = 1Bh, NOT(0Dh)
06h [ch8594] 1Bh, F9h = 1Bh, NOT(06h)
1Bh [ch8594] 1Bh, E4h = 1Bh, NOT(1Bh)

The array can look like

3F 10 01 00 80 D4 08 Before replacement
3F 10 01 00 1B 7F D4 08 After replacement

or an other example

3F 10 00 80 16 04 11 06 2A F0 24 F3 8A Before replacement
3F 10 00 1B 7F 16 04 11 1B F9 F0 24 F3 8A After replacement

Andy Brown example.
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1280025231

You seem to require a lot of functionality offered by the Arduino String object. In your last topic you needed to find a substring, now you want to replace one substring with another. With this object, you can do both. Have you tried this class?

You seem to require a lot of functionality offered by the Arduino String object.

There are a lot of values in OPs array that are not printable characters, so strings won't work.

This is just basic array manipulation, too.

There are a lot of values in OPs array that are not printable characters, so strings won't work.

Oh, I didn't realise the Arduino String object can't safely handle non-printable characters. It can't, though?

(Edit: Ah yes, the problem would occur only if there's a null-byte in the char array, right? That would cut off any String-implemention. Good catch, thank you. If there's guaranteed to be no null-bytes, the String-object should work, though.)

If this is the case, I think something like the next approach is needed:

1. Count the number of replacements you want to make in the array.
2. If count > 0, calculate the length of the new array you want to make.
3. Create new array of proper length.
4. Loop though the original array, copying all chars into the new array, unless they are to be replaced, in which case you copy the replacement characters.

Because you can't change the length of a created array, this seems to me the most practical approach.