Function in bytes coil-stdlib

from_string

fn from_string(string s) -> Vec<byte>
Import
use bytes::{from_string};
Source: src/bytes.hy

Returns the UTF-8 bytes of s; the same as string::to_bytes.

Parameters#

NameType
sstring

Returns#

Vec<byte>

Contracts#

Checked according to --contracts (see Contracts).

ensures result.len() == s.len()

See also#

  • string::to_bytes
  • region_eq: True when a[ao..ao+n) equals b[bo..bo+n) (caller guarantees bounds).
  • to_hex: Encodes buf as lowercase hexadecimal, two digits per byte.
  • from_hex: Decodes hexadecimal text (either case) into bytes.
  • slice: Returns a copy of src[start..end] (end exclusive), with both offsets clamped to the buffer.
  • concat: Returns a new buffer holding a followed by b.
  • eq: Returns true when a and b have the same length and the same bytes.
  • find_from: Returns the offset of the first needle in hay at or after start, or -1.
↑ ↓ navigate ↵ open