Remove everything before and after a string part in Android

Simple

New Member
#1
I want to get Amazon product ASIN from the URL here are some examples:
Mã:
https://www.amazon.com/Premium-Flagship-Lenovo-Processor-Bluetooth/dp/B07H15QHT6/ref=sr_1_2_sspa?s=pc&ie=UTF8&qid=1537733386&sr=1-2-spons&keywords=laptop&psc=1


https://www.amazon.com/Youve-Got-Crabs-Creators-Exploding/dp/B07BKLT9B5/ref=mp_s_a_1_1?ie=UTF8&qid=1537733019&sr=8-1-spons&pi=AC_SX236_SY340_FMwebp_QL65&keywords=games&psc=1
I want to get that text after /dp/ and remove everything after that text like this
Mã:
B07BKLT9B5 and B07H15QHT6
 

Admin

Administrator
Thành viên BQT
#2
You can use:
Mã:
split("dp")
And get 2 part or use substring() and indexOf() method.
 
Top