Skip to content

Add IsCurrency to StringExtensions. #72

Open
@Arlodotexe

Description

@Arlodotexe

Continuing from Currency validation support #4430.

We'd like to add an IsCurrency extension method to StringExtensions that bundles an easy and obvious check for if a string is a valid currency, similar to IsDecimal.

This would be implemented like so

public static bool IsCurrency([NotNullWhen(true)] this string? str)
{
    return decimal.TryParse(str, NumberStyles.Currency, out _);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    common 💼Issues/PRs for the Common packagefeature request 📬A request for new changes to improve functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions