Skip to main content

fromstring

Function fromstring 

Source
pub fn fromstring<T>(s: &str, sep: &str) -> FerrayResult<Array<T, Ix1>>
where T: Element + FromStr, <T as FromStr>::Err: Display,
Expand description

Construct a 1-D array from a whitespace- or separator-delimited string.

Each token is parsed via T::from_str (any type implementing std::str::FromStr). Empty tokens are ignored.

Analogous to numpy.fromstring(s, sep=...) (the binary mode of NumPy fromstring is deprecated in favor of frombuffer, so we only implement the text-parsing form here).

ยงErrors

Returns FerrayError::InvalidValue if any token fails to parse.