avatarview-android icon indicating copy to clipboard operation
avatarview-android copied to clipboard

App Gets Crashed when textInitials Contains Multiple spaces in between. For eg :- "Test Name"

Open mdhanif-simformsolutions opened this issue 2 years ago • 0 comments

Hi, Thanks for this amazing library, I found one issue here :- When we set textInitials which contains multiple spaces in between at that time app is crashed :- Eg :- When I try to set textInitials = Test Name

So main issue is here :- /** Returns parsed initials from a String. */ internal val String.parseInitials: String @JvmSynthetic inline get() { val textList = trim().split(" ") return when { textList.size > 1 -> "${textList[0][0]}${textList[1][0]}" textList[0].length > 1 -> "${textList[0][0]}${textList[0][1]}" textList[0].isNotEmpty() -> "${textList[0][0]}" else -> "" }.uppercase() }

Now now when `Test     Name` is split it gives [Test, , ,Name] here second and third space is empty