I have a string
abc.xyz.qweweer.cccc
This is actually going to be a Java package name.
I am trying to find out the last string using reg exp, in the above example cccc is the last String.
Basically I am trying to find out the class name from the package string.
How to find out through Java
Given a string
pkg = "abc.xyz.qweweer.cccc"you can solve it like this:Using
indexOf:Using regular expressions with
Matcher:Using
split(variation of RMT’s answer):