fromStrings

fun fromStrings(fromValueString: String, unitFrom: Scale.UnitFrom, toValueString: String, unitTo: Scale.UnitTo): Scale?

Creates a Scale from string values, supporting fractional input (e.g., "3/16", "3 1/2"). This is the recommended API for creating scales with user input.

Return

A new Scale instance, or null if the input strings cannot be parsed as valid numbers

Parameters

fromValueString

String representation of the source scale value (e.g., "1", "3.14", "1/2", "3 1/2")

unitFrom

Unit for the source scale value

toValueString

String representation of the target scale value

unitTo

Unit for the target scale value