From: Sammy Mitchell
Stig Rindom[SMTP:stig-rindom@post.dk-online.dk] wrote:
> I need an inverse of the function ChrSet. Otherwise it=B4s difficult
> to show the user the exsisting wordset in af prompt.
> As far as I can see, there is no such function built in!
>=20
> Has anyone out there made such a function?
>=20
This is the code the editor uses to display the wordset in the =
full-configuration menus:
string code[] =3D "dxoxxxabtnvfr"
string proc mChr(integer i)
case i
when 0..6, 14..31, 255 // ctrl chars
return (Format('\d',i:3:'0'))
when 7..13 // bell, backspace, tab, lf, vtab, =
ff, cr
return ('\'+code[i])
when 34, 45, 92 // ", -, \
return ('\'+Chr(i))
endcase
return (Chr(i))
end
string proc rWordSet(string s)
string ws[255] =3D ''
integer i =3D 0, n
while i < 256
if GetBit(s, i)
ws =3D ws + mChr(i)
n =3D i + 1
while n < 256 and GetBit(s, n)
n =3D n + 1
endwhile
n =3D n - 1
if n - i > 1
ws =3D ws + '-' + mChr(n)
i =3D n
endif
endif
i =3D i + 1
endwhile
// check for '-' at beginning and remove the '\' from before it
if (SubStr(ws, 1, 2) =3D=3D "\-")
ws =3D SubStr(ws, 2, 255)
endif
return (ws)
end
proc main()
Warn(rWordSet(Query(WordSet)))
end
Sammy Mitchell
SemWare Corp.
---
---------------
* Origin: apana>>>>>fidonet [sawasdi.apana.org.au] (3:800/846.13)
|