Commit 25/09/2025

This commit is contained in:
rdkartono
2025-09-25 11:28:52 +07:00
parent 7db10bd45a
commit e18a08ab6a
3 changed files with 261 additions and 72 deletions

View File

@@ -38,6 +38,20 @@ class Somecodes {
// regex for getting ann_id from Message, which is the number inside []
private val ann_id_regex = Regex("\\[(\\d+)]")
/**
* Check if a string is a valid number.
*/
fun IsNumber(value: String) : Boolean {
return value.toIntOrNull() != null
}
/**
* Check if a string is alphabetic (contains only letters).
*/
fun IsAlphabethic(value: String) : Boolean {
return value.all { it.isLetter() }
}
/**
* Extract ANN ID from a message string.
* The ANN ID is expected to be a number enclosed in square brackets (e.g., "[123]").