I wanted to know the index number of an array so tried as shown below.
val countryCodeList = arrayListOf(*resources.getStringArray(R.array.countryCodes))
val countryIndex = countryCodeList.indexOf("+1")
And it only returns true(0) & false(-1). If string "+1" locates on the 4th row of the list, I want it to return 3 for the result.
How can I receive the index number of an arrayList?
Log
array : [+82, Korea]
result: -1
==================================================
array : [+60, Malaysia]
result: -1
==================================================
array : [+1, USA]
result: 0