Function malachite_base::strings::exhaustive::exhaustive_fixed_length_strings
source · [−]pub fn exhaustive_fixed_length_strings(
len: u64
) -> StringsFromCharVecs<ExhaustiveFixedLengthVecs1Input<ExhaustiveChars>>ⓘNotable traits for StringsFromCharVecs<I>impl<I: Iterator<Item = Vec<char>>> Iterator for StringsFromCharVecs<I> type Item = String;
Expand description
Generates all String
s of a given length.
The output length is $1112064^n$, where $n$ is len
.
If len
is 0, the output consists of one empty String
.
Examples
extern crate itertools;
use itertools::Itertools;
use malachite_base::strings::exhaustive::exhaustive_fixed_length_strings;
let ss = exhaustive_fixed_length_strings(2).take(20).collect_vec();
assert_eq!(
ss.iter().map(|cs| cs.as_str()).collect_vec().as_slice(),
&[
"aa", "ab", "ba", "bb", "ac", "ad", "bc", "bd", "ca", "cb", "da", "db", "cc", "cd",
"dc", "dd", "ae", "af", "be", "bf"
]
);