Skip to main content

translate

Function translate 

Source
pub fn translate<D: Dimension>(
    a: &StringArray<D>,
    table: &HashMap<char, Option<char>>,
) -> FerrayResult<StringArray<D>>
Expand description

Apply a per-character translation table to each element.

table maps each input char to:

  • Some(c) — replacement character (single char)
  • None — drop the character (delete from output)

Characters not present in table are passed through unchanged. Mirrors numpy.strings.translate(arr, table).

§Errors

Returns an error if the internal array construction fails.