manpagez: man pages & more
info guile
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.24.4 Number Input and Output

The following procedures allow programs to read and write numbers written according to a particular locale. As an example, in English, “ten thousand and a half” is usually written 10,000.5 while in French it is written 10 000,5. These procedures allow such differences to be taken into account.

Scheme Procedure: locale-string->integer str [base [locale]]
C Function: scm_locale_string_to_integer (str, base, locale)

Convert string str into an integer according to either locale (a locale object as returned by make-locale) or the current process locale. If base is specified, then it determines the base of the integer being read (e.g., 16 for an hexadecimal number, 10 for a decimal number); by default, decimal numbers are read. Return two values (see section Returning and Accepting Multiple Values): an integer (on success) or #f, and the number of characters read from str (0 on failure).

This function is based on the C library’s strtol function (see strtol in The GNU C Library Reference Manual).

Scheme Procedure: locale-string->inexact str [locale]
C Function: scm_locale_string_to_inexact (str, locale)

Convert string str into an inexact number according to either locale (a locale object as returned by make-locale) or the current process locale. Return two values (see section Returning and Accepting Multiple Values): an inexact number (on success) or #f, and the number of characters read from str (0 on failure).

This function is based on the C library’s strtod function (see strtod in The GNU C Library Reference Manual).

Scheme Procedure: number->locale-string number [fraction-digits [locale]]

Convert number (an inexact) into a string according to the cultural conventions of either locale (a locale object) or the current locale. Optionally, fraction-digits may be bound to an integer specifying the number of fractional digits to be displayed.

Scheme Procedure: monetary-amount->locale-string amount intl? [locale]

Convert amount (an inexact denoting a monetary amount) into a string according to the cultural conventions of either locale (a locale object) or the current locale. If intl? is true, then the international monetary format for the given locale is used (see international and locale monetary formats in The GNU C Library Reference Manual).


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on April 20, 2013 using texi2html 5.0.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.