Find first available serial based on list of strings?

后端 未结 4 1179
挽巷
挽巷 2021-01-26 02:34

Given a list of strings such as: apple01, apple02, and apple04, banana02, cherry01, how would you come up with t

4条回答
  •  情书的邮戳
    2021-01-26 02:48

    if the name that occurs first is pure letters not including any number and than followed by a number . that would be easy and you can get the index of the first number or char that exists in that char list {1,2,3,4,5,6,7,8,9} and than you can make substring(0,indexof(firstnumber))

提交回复
热议问题