I have a dynamically formed string like - part1.abc.part2.abc.part3.abc
whose length is unknown
In this string I want to get the substring based on second occurrence of "." so that I can get and part1.abc
part2.abc
part3.abc
.
And if the string is like - part1.abc.part2.abc.part3.abc.part4
output must be like part1.abc
part2.abc
part3.abc
part4
How to get this?
As suggested in my comment, the simplest (and fastest) way is to use a regular expression and match:
Simple function which allows you to specify the number of items to join together and delimiter which you can use to join them.
Something like this :