I have a url which looks like this https://test.sample.com/product/<product_Id>/subproduct/<sub_product_id>
I'm trying to get the <product_id>
and <sub_product_id>
from this in the best clean way possible.
What I've tried is to do a String split, loop through each item and get the items after "product" and "subproduct".
Is this the only way to do this ? Or rather the best possible way ?