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
@Sacha started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
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
correct is:
=[ "Dear ", "" ]
See : http://jsconsole.com/?%27Dear%20Espruino%27.split(%27Espruino%27)%3B
Sacha