Updated on 2026-08-14
This commit is contained in:
parent
3d887a5574
commit
06b13f2227
15 changed files with 491 additions and 243 deletions
|
|
@ -0,0 +1,14 @@
|
|||
package com.tangem.utils
|
||||
|
||||
/**
|
||||
* Convert address to brief format. Example, 33BddS...ga2B.
|
||||
* If [this.length] is less than a sum of [startCharsCount] and [endCharsCount], return [this].
|
||||
*/
|
||||
fun String.toBriefAddressFormat(startCharsCount: Int = 6, endCharsCount: Int = 4): String {
|
||||
return if (startCharsCount + endCharsCount < length) {
|
||||
substring(startIndex = 0, endIndex = startCharsCount) + "..." +
|
||||
substring(startIndex = length - endCharsCount, endIndex = length)
|
||||
} else {
|
||||
this
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.tangem.utils.extensions
|
||||
|
||||
import org.joda.time.DateTime
|
||||
import org.joda.time.LocalDate
|
||||
|
||||
fun DateTime.isToday(): Boolean = LocalDate.now().equals(LocalDate(this))
|
||||
|
||||
fun DateTime.isYesterday(): Boolean = LocalDate.now().minusDays(1).equals(LocalDate(this))
|
||||
Loading…
Add table
Add a link
Reference in a new issue