replace() missing #263
Replies: 7 comments
-
Posted at 2014-04-20 by @gfwilliams Thanks. I've just made a bug for this: espruino/Espruino#334 Any code contributions welcome ;) For now you can probably work around it by writing your own replace function though. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-04-20 by Sacha Yes, no problem with that. Sacha |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-04-24 by Andreas Hi there, |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-04-24 by @gfwilliams You could run this beforehand...
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-04-29 by Sacha 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 |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-04-30 by @gfwilliams Thanks. I'll file a bug for this - I was sure i'd tested for that case though! In the mean time, if you try one of the later builds from Git, String.replace is already implemented. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-04-30 by Sacha Thanks Gordon, nice to have replace. Sacha |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2014-04-19 by Sacha
Hi Gordon,
The replace() function is missing. This code works on jconsole.com:
var str = "Play with Arduino";
var res = str.replace("Arduino","Espruino");
Sacha
Beta Was this translation helpful? Give feedback.
All reactions