Hi, I've been going nuts lately on different clash of coding because I can't use the split method. Eveytime I try to convert a string to an array using the split function, I get an error saying that "Split() is not a function".
Am I the only one having this problem ?
Maybe because you wrote it with uppercase S instead of split? At least that's what the error message implies.
Well, there could be a couple of things which you could be overlooking like:1. Maybe you forgot to import the "util" package. (I am assuming you're working with java)2. You could be typing String.Split() instead of String.split();3. Sometimes not choosing the right version of compiler gives this error where you have to choose among different compiler so, try going for the oracle version of the compiler instead of the "open" compilers.Hope this helps. Pardon me if I didn't get it right.Cheers.
Quick example of using split in js:
var str = 'test1 test2 test3';
var splitted = str.split(' ');
You can also do the same in one line:
var splitted = 'test1 test2 test3'.split(' ');
You know, that this is from May 2017, right?
And I just tested the .splitted() function in the browser console, it doesn't work.