SV: string:left (bug ?!)

Jonas Åman jonas.aman@REDACTED
Tue Aug 12 08:47:01 CEST 2003


Hello.

When using string:left with only two arguments, the second argument should
be an integer. Since the data type character is integers, the function call
string:left(string(), char()) should normally return a new string, however
wrong it may be. But "$' '" is not a valid character, which is the reason
that it does not work. The shell is waiting for another "'" to terminate the
atom started by the second "'" in "$' '".

If you want to pad your string with blanks, you should do like this:

string:left(String, Number) or
string:left(String, Number, Character). Used on the above string, padding it
with spaces, therefor looks like this:

string:left("hello", 10) or
string:left("hello", 10, $ ).

/Jonas


-----Ursprungligt meddelande-----
Från: owner-erlang-questions@REDACTED
[mailto:owner-erlang-questions@REDACTED]För Jilani Khaldi
Skickat: den 11 augusti 2003 23:22
Till: erlang-questions@REDACTED
Ämne: string:left (bug ?!)


Hello All,

try this:

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?

Thanks.

ps.
Slackware Linux 9.0

jilani






More information about the erlang-questions mailing list