We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Quick question about splitTokens.
var s = "sldfkjalfkgh,df. sdkfj !";
var words = splitTokens(s, " ,");
this returns the original string. Any ideas?
It's indeed bugged b/c in "Java Mode" it does work: >:/
String s = "sldfkjalfkgh,df. sdkfj !";
String words = splitTokens(s, " ,");
File an issue for it here: https://github.com/processing/p5.js/issues
And post the link for this post there too for cross-reference! Good luck! :-bd
For questions like this, it's best to use JSFiddle. Here's one: https://jsfiddle.net/gvfc5u2x/
This is not a bug. Run the above JSFiddle and you'll see this output:
Array [ "sldfkjalfkgh", "df.", "sdkfj", "!" ]
So you see that your code is working. It's unclear what you mean by "this returns the original String" since you aren't returning anything.
Please modify the existing JSFiddle, or post an MCVE that demonstrates exactly what you're doing.
Sorry, I didn't say this clearly. I'm having issue with P5.JS not in processing JS.
There seem to be a lot of p5 methods which I assume just hook into the native JS equivalent. I'm inclined to favour the native method...
yeah, that's a good point. That's what I'm using right now.
That doesn't fix the bug present in p5*js's implementation for splitTokens()! [-(
But there seems little point for implementations of the various Math functions... Presumably p5.abs() just returns the value of Math.abs(); which looks like an unnecessary extra function call to me. Probably not a significant performance hit; but a hit nonetheless ;)
Just a quick look at https://processing.org/reference/ and it's easy to conclude that about a third of it already exists in the Java's API!