NEWTON

NEWTON


Popular tags

    Declaring Strings in Cairo

    Asked

    6 months ago

    18

    views


    0

    What is the proper way to declare a string in Cairo?

    This question was originally posted on Triality

      cairocairo-lang

    1 answers

    0

    Cairo supports short strings up to 31 characters https://www.cairo-lang.org/docs/how_cairo_works/consts.html#short-string-literals. If you want to work with more than that, there's a library you can use https://github.com/topology-gg/caistring. Essentialy, it creates a Str type as a struct that has a length and a pointer to an array of short strings.

    struct Str:

    member arr_len : felt

    member arr : felt*

    end

    

    This answer was originally posted on Triality

    answered

    6 months ago

    Your answer

    NEWTON

    NEWTON