but you havnt clearly explained what o\p u desire ??
ur NNN,NNN,NNN.NN example is just too vague
now i assume that i\p shld be like.
1234 --> 1,234
12345 --> 12,345
where i\p is supplied at runtime.
if such case u can write a small proc using multiple cases which can use
length scalar fn.
and then can manipulate position of ',' to some condition like multilples of 3.
there could be better soln or much more specific function but i am not able to think of that