CString concatenation advice pls

Started by
0 comments, last by andrewcw 20 years ago
One of my functions must take html from browser and rebuild for printing ( the orig files are XML )-- char by char and replace unicode with enities. I have to do this because the legacy code is not complied with the unicode version of MFC. While my code works, I dont know if CString is very efficient at concatenation ( should I be using another way ). The file size ranges between a few KB to 120 KB with an average of 30 KB. Also printing is not a typical function so a small wait is not that much of an issue. I did not find much about the topic ( unlike VB and C# for optimizing string building ). Here''s the major part of that work.... your opinion ?? Thanks long NUM_LOOP= SysStringLen(bstrHTML); for(long i=0; i256) { strFormat.Format("%d",charNum); theEntity="&#"+strFormat+";"; reBuildHTML+=theEntity; } else { char test = *ptrHTML; // code almost always goes through here. reBuildHTML+= test; } ptrHTML++; } // end of for loop return reBuildHTML; andrew
andrew
Advertisement
quote:Original post by andrewcw
One of my functions must take html from browser and rebuild for printing ( the orig files are XML )-- char by char and replace unicode with enities. I have to do this because the legacy code is not complied with the unicode version of MFC.

While my code works, I dont know if CString is very efficient


Why don''t you try running it on a sample of your data, and see if it runs acceptably fast?

This topic is closed to new replies.

Advertisement