Reputation: 1016
I have a date in the form of a string, and it looks like this:
"21.07. - 10.08."
I was wondering how do I split the two into two strings, and lose the " - ".
Something that would make string1 = "21.07."
and string2 = "10.08."
Upvotes: 0
Views: 942
Reputation: 1564
I actually don't know Python, but I found this thread.
Seems like you can split into a list:
mylist = mystr.split("-", 1)
Then...
string1 = mylist[0]; #This contains "21.07."
string2 = mylist[1]; #This contains "10.08."
Upvotes: 0
Reputation: 189
Split the String at the "-". This will give you a String array. Concatenate the two array elements together to form one String.
In java this would be:
String[] splitted = stringToSPlit.split("-");
String result = splitted[0] + splitted[1];
Upvotes: 0