Explorer

std.utf8-byte-string

description
A string of one byte (definy strings are UTF-8 byte arrays). Made by slicing a literal containing the byte. Bytes that never appear in UTF-8 become U+FFFD
type
Fn(byte: Number) -> String
expression
fn(byte$0) =>
  match @core.less-than(left: $0, right: 128) {
    true =>
      @core.string-slice(
        value: "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\t\n\u000b\u000c\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",
        start: $0,
        end: @core.plus(left: $0, right: 1)
      ),
    false =>
      match @core.less-than(left: $0, right: 192) {
        true =>
          let index$1 = @core.plus(left: @core.multiply(left: @core.minus(left: $0, right: 128), right: 2), right: 1);
          @core.string-slice(
            value: "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿",
            start: $1,
            end: @core.plus(left: $1, right: 1)
          ),
        false =>
          match @core.less-than(left: $0, right: 194) {
            true =>
              "�",
            false =>
              match @core.less-than(left: $0, right: 224) {
                true =>
                  let index$2 = @core.multiply(left: @core.minus(left: $0, right: 194), right: 2);
                  @core.string-slice(
                    value: "€ÀĀŀƀǀȀɀʀˀ̀̀΀πЀрҀӀԀՀր׀؀ـڀۀ܀݀ހ߀",
                    start: $2,
                    end: @core.plus(left: $2, right: 1)
                  ),
                false =>
                  match @core.less-than(left: $0, right: 240) {
                    true =>
                      let index$3 = @core.multiply(left: @core.minus(left: $0, right: 224), right: 3);
                      @core.string-slice(
                        value: "ࠀက  䀀倀怀瀀耀退ꀀ뀀쀀퀀",
                        start: $3,
                        end: @core.plus(left: $3, right: 1)
                      ),
                    false =>
                      match @core.less-than(left: $0, right: 245) {
                        true =>
                          let index$4 = @core.multiply(left: @core.minus(left: $0, right: 240), right: 4);
                          @core.string-slice(value: "𐀀񀀀򀀀󀀀􀀀", start: $4, end: @core.plus(left: $4, right: 1)),
                        false =>
                          "�"
                      }
                  }
              }
          }
      }
  }
visibility
public
std.utf8-byte-string (project definy, branch local-host-wasi-io, snapshot 6q6wel2IrvXMEdXtZFbi0BgBld-vO0GChR39-U-GIJY)
id: io1kADHgmCHG2FRmeiMryfkCK-BuCx3EZB6ERh5-8os
content hash: j2GfeHi2BISLPntC4TIHayODvHiuKxYarB6WgyhxDR8