1

is it possible to replace bytes to chars in this method:

byte[] sttrings = new byte[pntrs[i + 1] - pntrs[i]];
stream.Position = pntrs[i];
stream.Read(sttrings, 0, sttrings.Length);
Strs[i] = Encoding.GetEncoding("SHIFT-JIS").GetString(sttrings).Split('\0')[0].Replace("[FF00]", "/et");

where 0x00FF (in hex editor it is FF 00) is the byte i want to replace with "/et"

1 Answer 1

2

Assuming you are looking for the unicode char 0x00FF (ÿ) you just need to use the Unicode escape character `\uxxxx.

byte[] sttrings = new byte[pntrs[i + 1] - pntrs[i]];
stream.Position = pntrs[i];
stream.Read(sttrings, 0, sttrings.Length);
Strs[i] = Encoding.GetEncoding("SHIFT-JIS").GetString(sttrings).Split('\0')[0].Replace("[\u00FF]" , "/et");

If you really want to replace the byte values you may be able to use the String constructor that takes in a char[].

string replacementString = new String(new char[] {'[', '\0', (char)0xFF, ']'});
Sign up to request clarification or add additional context in comments.

1 Comment

thank you sir :), but where do i put the string replacement ? before or after i get the strings ? or before reading ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.