I have that string :
a = "Hello, my name is Peter, John"
I tried to split such as :
a.split(",")
But I got that :
["Hello", "my name is Peter", "John"]
But I would like to get that :
["Hello", "my name is Peter, John"]
I have that string :
a = "Hello, my name is Peter, John"
I tried to split such as :
a.split(",")
But I got that :
["Hello", "my name is Peter", "John"]
But I would like to get that :
["Hello", "my name is Peter, John"]
You can use the second argument of the split function to define how many times you want the string to be spitted (counting from the beginning). Setting it to 1
should solve your problem:
a.split(",", 1)