How to arrange , separated text (add every 24th comma to \n)

1. I got RGB color map value (256*3) = 768 values as below:

colorarray07[256*3] = {
0,0,255,
0,0,255,
0,0,255,
0,0,255,
0,0,255,
0,0,255,
0,0,255,
0,0,255,
0,0,255,
0,0,255,
...
}

2. I would like to arrange like this:
colorarray07[256*3] = {
    0,0,255, 0,0,255, 0,0,255, 0,0,255, 0,0,255, 0,0,255, 0,0,255, 0,0,255,
    ...
    }

3. Using VSCODE, I copied value section to vscode.
0,0,255,
0,0,255,
0,0,255,
0,0,255,
0,0,255,
0,0,255,
0,0,255,
0,0,255,
0,0,255,
0,0,255,
...

4. Replace all using following condition with regex on (to make one line text)
,\n 
to
,

5. Replace all using following condition with regex as follows:
([0-9]+\,){24}
to
$0\n

6. It works like charm.


Comments

Popular posts from this blog

[VS2010][VS2015] "stdafx.h 을 포함 소스를 찾을 수 없습니다" 에러 해결법