T O P I C R E V I E W |
Paul |
Posted - Mar 08 2016 : 1:50:07 PM It would be handy to have functions that:
1) Convert backslashes to forward slashes. \home\my\subfolder to /home/my/subfolder 2) Convert forward slashes to doubled backslashes. /home/my/subfolder to \\home\\my\\subfolder 3) Convert single backslashes to doubled backslashes. \home\my\subfolder to \\home\\my\\subfolder |
3 L A T E S T R E P L I E S (Newest First) |
feline |
Posted - Mar 29 2016 : 2:17:11 PM You should be able to do a regular expression find and replace to do the replacements in strings fairly easily, but this is also going to update some, possibly quite a few #include lines as well.
Swapping / to \ in your #include statements won't matter, but changing \ to \\ may.
Thinking a little more, you could put a "line not starting with #" at the start of the regular expression, which should make this fairly safe and reliable.
Depending on your IDE, you could even wrap this up in an IDE macro, to make it easy to run this across your entire project.
"formatting" like this is not something VA offers, unfortunately, since everyone wants something different, and it quickly becomes a very complex area. |
Paul |
Posted - Mar 29 2016 : 11:54:09 AM Mostly in strings that refer to file paths. We specify using forward slashes and let underlying code convert to the platform specific directory separators. That code can handle the backslashes as well, for neatness, consistency and correctness, I prefer everyone use the forward slashes. |
feline |
Posted - Mar 08 2016 : 2:14:54 PM Have you considered simply using a find and replace? Are you looking to do this on strings? #include lines? Something else? |
|
|