Prof A Olowofoyeku (The African Chief) wrote:
On 22 Mar 2005 at 22:28, Frank Heckenbach wrote: [...]
Of course, you could also convert the octal to (hexa)decimal numbers.
[...]
Can we have a series of conversion routines (perhaps in gpcutil.pas)? octal2hex hex2octal int2octal octal2int
For input, we have the BP way (`$' for hex) and the EP way (`16#' for hex, `8#' for octal and the same for any other base between 2 and 36). They also work in `Read[Str]' and `Val' (unless disabled by dialect options).
So `Val ('8#' + s, Num, ErrPos)' is one way to convert a string s in octal form to an integer with error checking.
On the output side, we have `Integer2StringBase' and `Integer2StringBaseExt' in the GPC module.
Frank