Nix 2.93.3
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
Loading...
Searching...
No Matches
english.hh File Reference
#include <iostream>
#include <algorithm>
#include <iterator>
#include <ranges>
#include <sstream>

Go to the source code of this file.

Functions

std::ostream & nix::pluralize (std::ostream &output, unsigned int count, const std::string_view single, const std::string_view plural)
template<typename F, std::ranges::input_range R>
std::string nix::concatStringsCommaAnd (F transform, const R &args)

Function Documentation

◆ concatStringsCommaAnd()

template<typename F, std::ranges::input_range R>
std::string nix::concatStringsCommaAnd ( F transform,
const R & args )

Concatenates a given iterator of strings with commas and 'and', while transforming them with the given function. e.g. ["foo", "bar", "baz"] might get concatenated to "foobar, barbar and bazbar". the lambda for this might look like this: [](std::string & arg) { return arg + "bar"; };

◆ pluralize()

std::ostream & nix::pluralize ( std::ostream & output,
unsigned int count,
const std::string_view single,
const std::string_view plural )

Pluralize a given value.

If count == 1, prints 1 {single} to output, otherwise prints {count} {plural}.