Subversion Repositories wimsdev

Rev

Rev 20 | Rev 4158 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
20 reyssat 1
!if $wims_read_parm!=slib_header
2
 !goto proc
3
!endif
4
slib_title=Ecriture d'un nombre avec regroupement des chiffres par trois.
5
slib_parms=1\
6
Le nombre en question
7
 
8
slib_author=Fabrice Guerimand 
3265 bpr 9
slib_out=Le nombre écrit avec des espaces.
20 reyssat 10
!exit
11
 
12
:proc
13
slib_input=$wims_read_parm
14
 
15
test=$[$slib_input]
16
!if NaN isin $test
17
 slib_out=NaN
18
 !exit
19
!endif
20
 
21
!if e isin $slib_input
22
 slib_out=$slib_input
23
 !exit
24
!endif
25
 
26
decomp=!replace internal . by , in $slib_input
27
part=!item 1 of $decomp
28
nbchi=!charcnt $part
29
nbgrp=$[floor($nbchi/3)]
30
slib_out=$empty
31
!ifval $nbgrp*3!=$nbchi
32
 slib_out=!char 1 to $[$nbchi-3*$nbgrp] of $part
33
!endif
34
!for i=0 to $nbgrp-1 
35
 tmp=!char $[$nbchi-3*($nbgrp-$i)+1] to $[$nbchi-3*($nbgrp-$i-1)] of $part
36
 slib_out=$slib_out $tmp
37
!next i
38
 
39
tst=!itemcnt $decomp
40
!if $tst=1
41
 !exit
42
!endif
43
part=!item 2 of $decomp
44
nbchi=!charcnt $part
45
nbgrp=$[ceil($nbchi/3)]
46
tmp=!char 1 to 3 of $part
47
slib_out=$(slib_out).$tmp
48
!for i=1 to $nbgrp 
49
 tmp=!char $[1+3*($i)] to $[3+3*$i] of $part
50
 slib_out=$slib_out $tmp 
51
!next i