Hi guys !
In brief, I want to build a function in c++ that it's input is a given string with size 300, and the second input is the specified substring. this function is finds if there's my inversion of a given substring (second input) is found in a given string (first input) and if it's found then the function returns new string which its beginIndex is starting from the last index of appearance/occurrence of a substring in my given string and the endIndex of the returning new string is (last index of apperance/occurance of substring + 10offset).
assumptions :
1)the string is binary data this mean "0101111......111"
2)my substring-first input- is constant string and it's "1010" and my string -second input- is always starts with "1010" and could be repeated many times continuously in my string like "101010101010 .. " here 3 times repeated .. , so because my substring is constant which it's "1010", the inversion substring is alwaso constant which it's the invert of "1010" .... in my acase the inversion substring is "0101".
3) the substring is constant and already known in my question it's "0101" so the inversion substring string is also already known and constant which it's "1010" (the inversion of "0101").
According to what I explained above, I will clarify more by an example :
lets assume I have string like this "10101010101001010000000111" , and my substring is as what I said above constant "1010" , I want by my function coded in c++ to search for first occurrence of the inversion of my substring ("1010") which it's "0101" -I marked it by deep black color in my example- and then I will retrun as new string the followed 10 offset data from the last index of occurrence of my inversion substring, in my example I will return
"0000000111" , in other words I will step 10 offset in my string from last index of occurrence of my inversion substring (what I marked in red color)
I hope I explained my problem in detail, and just a note the number of occurences of my substring is uncountable .. could be repeated many times in my given string ... but once the inversion substring detected I must return the new string according to what I explained above, it could be more than inversion words repeated so I need to return all the new strings that are followed by the inversion substrings, for instance:
"1010101010100101000000011110101010101001010000001111" here there's two times my inversion substring occurred,
so I need to return followed 10 offset data of my string (the red data) , the output is an array of string (what I marked in red in my string example)
: {"0000000111", "0000001111" }
If the searched inversion substring in my string not found, then return -1 or whatever logically acceptable ..
thanks alot for any help/assistance guys!
In brief, I want to build a function in c++ that it's input is a given string with size 300, and the second input is the specified substring. this function is finds if there's my inversion of a given substring (second input) is found in a given string (first input) and if it's found then the function returns new string which its beginIndex is starting from the last index of appearance/occurrence of a substring in my given string and the endIndex of the returning new string is (last index of apperance/occurance of substring + 10offset).
assumptions :
1)the string is binary data this mean "0101111......111"
2)my substring-first input- is constant string and it's "1010" and my string -second input- is always starts with "1010" and could be repeated many times continuously in my string like "101010101010 .. " here 3 times repeated .. , so because my substring is constant which it's "1010", the inversion substring is alwaso constant which it's the invert of "1010" .... in my acase the inversion substring is "0101".
3) the substring is constant and already known in my question it's "0101" so the inversion substring string is also already known and constant which it's "1010" (the inversion of "0101").
According to what I explained above, I will clarify more by an example :
lets assume I have string like this "10101010101001010000000111" , and my substring is as what I said above constant "1010" , I want by my function coded in c++ to search for first occurrence of the inversion of my substring ("1010") which it's "0101" -I marked it by deep black color in my example- and then I will retrun as new string the followed 10 offset data from the last index of occurrence of my inversion substring, in my example I will return
"0000000111" , in other words I will step 10 offset in my string from last index of occurrence of my inversion substring (what I marked in red color)
I hope I explained my problem in detail, and just a note the number of occurences of my substring is uncountable .. could be repeated many times in my given string ... but once the inversion substring detected I must return the new string according to what I explained above, it could be more than inversion words repeated so I need to return all the new strings that are followed by the inversion substrings, for instance:
"1010101010100101000000011110101010101001010000001111" here there's two times my inversion substring occurred,
so I need to return followed 10 offset data of my string (the red data) , the output is an array of string (what I marked in red in my string example)
: {"0000000111", "0000001111" }
If the searched inversion substring in my string not found, then return -1 or whatever logically acceptable ..
thanks alot for any help/assistance guys!