as
Cast to a specific JVM type; use a nullable target to allow null.
Example.kalm
pub fun text(value: Any) -> Text = value as Text
pub fun maybeText(value: Any) -> Text? = value as Text?
Example.kalm
pub fun text(value: Any) -> Text = value as Text
pub fun maybeText(value: Any) -> Text? = value as Text?
Example.kalms
fun text(value: Any) -> Text = value as Text
fun maybeText(value: Any) -> Text? = value as Text?
Example.kalms
fun text(value: Any) -> Text = value as Text
fun maybeText(value: Any) -> Text? = value as Text?
Example.java
import java.util.Objects;
public final class Example {
public static String text(Object value) {
return (String) Objects.requireNonNull(value);
}
public static String maybeText(Object value) {
return (String) value;
}
}