xxxxxxxxxx
void main() {
String str1 = "Today, is, Thursday";
print("New String: ${str1.split(',')}");
}
xxxxxxxxxx
void main() {
String sentence = "Hello, how are you today?";
List<String> words = sentence.split(" "); // Splitting by space
print(words); // Output: [Hello,, how, are, you, today?]
}
xxxxxxxxxx
var string = "Hello world!";
string.split(" "); // ['Hello', 'world!'];