Skip to content
Discussions/App Development/Did DA considered to add a function such as isNonEmptyForum ↗

Did DA considered to add a function such as isNonEmpty

App Development4 posts85 views1 likesLast activity Oct 2024
CO
cohen.avrahamOP
Sep 2024

G-d willing

Hello,
Would you consider adding another function to the DA.Text lib a function such as:

isNonEmptyText: Text -> Bool
isNonEmptyText text = (not . Text.isEmpty) text

This is something that I do quite often, and instead of repeating this code in every place I use it, or placing it in a separated package, this way all my packages will use it, sounds a bit too much.

Thanks,

JO
Johan_Sjodin
Sep 2024

Hi @cohen.avraham,

you could as well define it as

    isNonEmptyText : Text -> Bool
    isNonEmptyText = (/=) ""

or simply use text /= "" instead of isNonEmptyText text.

Hope that helps,
Johan

CO
cohen.avraham
Sep 2024

Thanks @Johan_Sjodin for your reply.
I am aware of this, but I was curious about a dedicated function for it like there is for isEmpty
Anyway, thanks again

WA
WallaceKelly
Oct 2024

It is open source. :slight_smile: Here is an implementation:

github.com/digital-asset/daml

Add DA.Text.isNotEmpty function

digital-asset:maindigital-asset:add-da-text-isnotempty
opened 06:58PM - 10 Oct 24 UTC

A `Text.isNotEmpty` function is needed frequently enough to warrant being added

← Back to Discussions