StrictlyPositiveInt
@Since(version = KotoolsTypesVersion.V1_1_0)
Represents an integer number of type Int that is greater than zero.
You can use the toStrictlyPositiveInt method for creating an instance of this type.
Serialization and deserialization
The serialization and deserialization processes of this type behave like for the Int type.
Here's an example of Kotlin code that encodes and decodes this type using the JavaScript Object Notation (JSON) format from kotlinx.serialization:
val number: StrictlyPositiveInt = 123.toStrictlyPositiveInt()
.getOrThrow()
val encoded: String = Json.encodeToString(number)
assertEquals(expected = "123", actual = encoded)
val decoded: StrictlyPositiveInt = Json.decodeFromString(encoded)
assertEquals(expected = number, actual = decoded)
Content copied to clipboard
Types
Link copied to clipboard
object Companion
Contains declarations for holding or building a StrictlyPositiveInt.
Functions
Link copied to clipboard
@Since(version = KotoolsTypesVersion.V4_1_0)
@Since(version = KotoolsTypesVersion.V4_1_0)
Link copied to clipboard
@Since(version = KotoolsTypesVersion.V4_1_0)
Calculates the remainder of truncating division of this integer by the other one.
Link copied to clipboard
@ExperimentalSince(version = KotoolsTypesVersion.V4_4_0)
@ExperimentalSince(version = KotoolsTypesVersion.V4_4_0)
@ExperimentalSince(version = KotoolsTypesVersion.V4_4_0)
Returns the negative of this integer number.