If dansChaîne means inString, then you have the arguments in the wrong order. It should be inData(BYTE,PTR).
Optimized, for fun:
Lbl DimStr
0
While →r₃{r₁++-1}
!If →r₂ xor ' '
1
ElseIf inData(r₂,"i.:!")
2
ElseIf inData(r₂,"flst()[],;")
3
ElseIf inData(r₂,"z&~")
5
ElseIf inData(r₂,"mw*π$#@")
6
Else
4
End
+r₃
End
r₃
Return