Von - bis + quasi ohne das Limit (2147483647) mit und ohne Kommastellen ... z.B. der Tausender-Punkt.oder was sonst noch gegliedert werden soll.
Code: Select all
#singleinstance,force
st1=-12345678901234567890123456780000
st2=1234567890123,001
st3=0,0
st4=abcdefghijklmnopqrstuvwxyz12345678901
s=1 ; Startpunkt
g=3 ; Gruppe
t:= "." ; Trennzeichen
MsgBox,4096,,% r_l_sep(st1,s,g,t)
MsgBox,4096,,% r_l_sep(st2,s,g,t)
MsgBox,4096,,% r_l_sep(st3,s,g,t)
MsgBox,4096,,% r_l_sep(st4 , 1 , 6 , " | ")
r_l_sep(a , b , c , d) {
n := StrSplit(a, ",")
IF (n.maxIndex() > 1) {
a:= n[1] , nkst:= "," . n[2]
}
a:= StrReplace(a,"-", , n)
IF (n > 0)
vz:= "-"
L:= StrLen(a)
v:= mod(L,c)
IF (v > 0) {
R:= SubStr(a,1,v) , a:= SubStr(a,v+1,L-v)
}
Loop,% ceil(L/c) {
x%a_index% := substr(a,b,c) , z.= x%a_index% . d , b+=c
} z:= trim(R . d . z , d)
return z:= vz . z . nkst
}
gruss
gero