You are reading a single comment by @Sacha and its replies. Click here to read the full conversation.
  • Hi Gordon,

    Too much code, we have to save memory where ever it is possible until an Espruino++ with 96KB is available ;-)

    The split/join method is small:

    'Dear Espruino !'.split('Espruino').join('Gordon'));

    Worked. Returned:

    'Dear Gordon !'

    But there is another bug in split:

    'Dear Espruino'.split('Espruino').join('Gordon');

    Returns: 'Dear Espruno' and not 'Dear Gordon'

    The reason is that split fails to split the element when it's at the end of the string.

    'Dear Espruino'.split('Espruino') returns

    'Dear Espruino'.split('Espruino');
    =[ "Dear Espruino" ]

    correct is:

    =[ "Dear ", "" ]

    See : http://jsconsole.com/?%27Dear%20Espruino%27.split(%27Espruino%27)%3B

    Sacha

About

Avatar for Sacha @Sacha started