Skip to content

toBigDecimal and toBigDecimalOption #121

Open
@Lasering

Description

@Lasering
import scala.util.control.Exception.*
extension (s: String)
  def toBigDecimal: BigDecimal = BigDecimal(s)
  def toBigDecimalOption: Option[BigDecimal] = catching(classOf[NumberFormatException]).opt(toBigDecimal)

I can make a PR if this is something that would be accepted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions