string:left (bug ?!)

Richard Carlsson richardc@REDACTED
Tue Aug 12 08:28:01 CEST 2003


On Mon, 11 Aug 2003, Jilani Khaldi wrote:

> string:left("hello", $' ').
>
> The shell editor goes infinitely in input mode. I have to press CTRL-C
> to get back. Is this a bug result or something I ignore?

    ...(..., $' ').
             ^^
             yields the character code for '

    ...(..., $' ').
                ^
                starts a quoted atom, like 'foo'

so to end the atom you must type another ' character. Then you
will get the control back.

To get the character code for SPACE, you can write $\s
or $\040. TAB is $\t or $\011, and so on. For example:

    string:left(String, FieldWidth, $\s).

	/Richard


Richard Carlsson (richardc@REDACTED)   (This space intentionally left blank.)
E-mail: Richard.Carlsson@REDACTED	WWW: http://user.it.uu.se/~richardc/
 "Having users is like optimization: the wise course is to delay it."
   -- Paul Graham



More information about the erlang-questions mailing list