Skip to content

Formatting: Add formatList(arr) func to get string of list items #111

Description

@Farkhanda-Dalal

Description:
The formatList(arr) function will format an array of strings into a human-readable list.

Acceptance Criteria:

["apples","bananas","cherries"] → "apples, bananas, and cherries"

["apples","bananas"] → "apples and bananas"

["apple"] → "apple"

[] → "" (empty string for empty array)

The function must support proper Oxford comma handling.
Add comprehensive unit tests for arrays of different lengths (0, 1, 2, many).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Level 3Hard level Issuegssoc25GSSOC'25 approved issue

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions