mirror of
https://github.com/Matte23/circolapp.git
synced 2025-12-06 07:29:10 +00:00
Fix crash when extracting id
This commit is contained in:
@@ -38,7 +38,10 @@ data class Circular(
|
|||||||
) : Parcelable {
|
) : Parcelable {
|
||||||
companion object {
|
companion object {
|
||||||
fun generateFromString(string: String, url: String): Circular {
|
fun generateFromString(string: String, url: String): Circular {
|
||||||
val id = string.split(" ")[1]
|
val idRegex = """(\d+)"""
|
||||||
|
val matcherId = Pattern.compile(idRegex).matcher(string)
|
||||||
|
matcherId.find()
|
||||||
|
val id = matcherId.group(1)
|
||||||
|
|
||||||
val dateRegex = """(\d{2}/\d{2}/\d{4})"""
|
val dateRegex = """(\d{2}/\d{2}/\d{4})"""
|
||||||
val matcherDate = Pattern.compile(dateRegex).matcher(string)
|
val matcherDate = Pattern.compile(dateRegex).matcher(string)
|
||||||
|
|||||||
Reference in New Issue
Block a user