what is the purpose of the split on a string code example
Example 1: split string
const str = 'The quick brown fox jumps over the lazy dog.';
const words = str.split(' ');
console.log(words[3]);
// expected output: "fox"
const chars = str.split('');
console.log(chars[8]);
// expected output: "k"
const strCopy = str.split();
console.log(strCopy);
// expected output: Array ["The quick brown fox jumps over the lazy dog."]
Example 2: split on . in java
String textfile = "ReadMe.txt";
String filename = textfile.split("\\.")[0];
String extension = textfile.split("\\.")[1];
Example 3: split on . in java
String textfile = "ReadMe.txt";
String filename = textfile.split(".")[0];
String extension = textfile.split(".")[1];