Skip to content

Proposal: procedure to count number of words in a string #852

Open
@nedtaylor

Description

@nedtaylor

Motivation

I regularly need to count the number of delimiter-separated fields in a string.

When files have an arbitrary number of fields in a line, and you need to read them in to an allocatable array. Reading the line to a buffer and counting the number of fields in a line so that the array can first be allocated is very handy.

This is also particularly useful in the following situation:
line = "Hello there how are you?
where the delimiter is repeated, and you want to just count the number of delimiter-separated fields.

Prior Art

  • wordcount (wc) in bash

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    ideaProposition of an idea and opening an issue to discuss it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions