SpiecsEngine
 
Loading...
Searching...
No Matches

◆ CleanupOutputString()

template<size_t N, size_t K>
constexpr auto SpicesTest::InstrumentorUtils::CleanupOutputString ( const char(&) expr[N],
const char(&) remove[K] )
constexpr

Definition at line 184 of file Instrumentor.h.

185 {
186 ChangeResult<N> result = {};
187
188 size_t srcIndex = 0;
189 size_t dstIndex = 0;
190 while (srcIndex < N)
191 {
192 size_t matchIndex = 0;
193 while (matchIndex < K - 1 && srcIndex + matchIndex < N - 1 && expr[srcIndex + matchIndex] == remove[matchIndex])
194 matchIndex++;
195 if (matchIndex == K - 1)
196 srcIndex += matchIndex;
197 result.Data[dstIndex++] = expr[srcIndex] == '"' ? '\'' : expr[srcIndex];
198 srcIndex++;
199 }
200 return result;
201 }