![]() |
how to find and replace some group of characters in a char string with bytes? *basic
hi, some basic help i need here or not (=
1. i need to replace every "\4" word with 04 hex byte 2. i need to replace every "a" symbol with "b" symbol after "\r" word but not after "\e" word, replace "a" symbol with "b" symbol just until there is a "\e" word, after "\e" no replaceing "a" symbol with "b" symbol, but if there is an "\r" somewhere after "\e" - so replace hope you help me ^^" |
Re: how to find and replace some group of characters in a char string with bytes? *ba
Sounds fairly easy. How far have you got and where are you stuck?
I would implement this using a flag to track whether or not a "\e" (whatever that is) has occurred and replace "a" with "b" only if that flag is set. Also I'd use a counter for the first part and reset it every time I did a substitution. IOW, something like: Code:
flag=1 |
Re: how to find and replace some group of characters in a char string with bytes? *ba
1 Attachment(s)
hex i mean... like this +_+ *look attach
every "\4" should be replaced with 04 hex byte no matter about other things Quote:
i'm new at C++ but looping thru symbols and replaceing them looks easy (at least with my knowlegde of PAWN) but i think i'm stuck with condition of replacing and not replaceing if markers were found like i need to mark string from \r to \e (if \e is after, + even if it's not) to replace things and mark string from \e to \r (if \r is after, + even if it's not) to not replace i heard C++ has enchanced abilities to work with strings such way but i'm not sure |
Re: how to find and replace some group of characters in a char string with bytes? *ba
What exactly do you mean by a symbol? How many of them can you see on the highlighted line in the screen shot?
Is there a \4 on the screenshot, and if not could you post a screen shot that shows one? |
Re: how to find and replace some group of characters in a char string with bytes? *ba
a symbol, a character, a letter
anyway i think i found how to write bytes Code:
data.push_back(0x04); |
Re: how to find and replace some group of characters in a char string with bytes? *ba
output for text from test string is "bbcdefbbcdefabcdef"
when i use for input "hi" it outputs " . hi" (20 2E 14 20 68 69 in hex) and it conver every a to b, and when i input "\\s" it outputs either "sss" or "s\s" O_o can you look at my code and maybe tell me something how to fix it? Code:
// Modifier functor. |
| All times are GMT +5.5. The time now is 11:07. |