Grounds
    Preparing search index...

    Function String_

    • Creates a string Relish value.

      The name has an underscore suffix to avoid shadowing the global String object. Strings are encoded as UTF-8 with a variable-length size prefix using a tagged varint: 7 bits for lengths 0-127, or 4 bytes for larger strings.

      Parameters

      • value: string

        A JavaScript string

      Returns RelishString

      RelishString value

      import { String_, encode } from '@grounds/core';

      const greeting = String_('hello world');
      encode(greeting).match(
      (bytes) => console.log('String encoded:', bytes),
      (error) => console.error(error)
      );

      Named String_ (with trailing underscore) to avoid shadowing the global String type.

      • U8 for creating other value types
      • encode for encoding the string to bytes