commit 10/09/2025
This commit is contained in:
@@ -24,6 +24,7 @@ class Somecodes {
|
||||
val memory : GlobalMemory = si.hardware.memory
|
||||
val datetimeformat1: DateTimeFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss")
|
||||
val dateformat1: DateTimeFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy")
|
||||
val dateformat2: DateTimeFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy")
|
||||
val timeformat1: DateTimeFormatter = DateTimeFormatter.ofPattern("hh:mm:ss")
|
||||
val timeformat2: DateTimeFormatter = DateTimeFormatter.ofPattern("hh:mm")
|
||||
const val KB_threshold = 1024.0
|
||||
@@ -180,6 +181,24 @@ class Somecodes {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a string is a valid date in the format "dd-MM-yyyy".
|
||||
* This format is used for log HTML files.
|
||||
* @param value The string to check.
|
||||
* @return True if the string is a valid date, false otherwise.
|
||||
*/
|
||||
fun ValiDateForLogHtml(value: String): Boolean{
|
||||
return try{
|
||||
if (ValidString(value)){
|
||||
dateformat2.parse(value)
|
||||
true
|
||||
} else throw Exception()
|
||||
|
||||
} catch (_: Exception){
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a string is a valid time in the format "hh:mm:ss".
|
||||
* @param value The string to check.
|
||||
|
||||
Reference in New Issue
Block a user