c++ How to split string into two strings based on the last '.'

Viewed 4719

I want to split the string into two separate strings based on the last '.' For example, abc.text.sample.last should become abc.text.sample.

I tried using boost::split but it gives output as follows:

abc
text
sample
last

Construction of string adding '.' again will not be good idea as sequence matters. What will be the efficient way to do this?

6 Answers
Related