1

How can I manipulate strings in Vyper? In solidity I could use Nick Johnson's string library. He's using assembly to do that. But that's not possible with Vyper as far as I know.

1

As of Vyper 0.1.0b8, fixed-size strings are supported as string[N] where N is the maximum size of the string, like this:

foo: string[100]

@public
def __init__(_foo: string[100]):
    self.foo = _foo

@public
@constant
def get() -> string[100]:
    return self.foo

@public
def set(_val: string[100]):
    self.foo = _val

Keep pounding the refresh button at this link to keep up-to-date with new Vyper releases: https://media.readthedocs.org/pdf/vyper/latest/vyper.pdf

In ^those docs you'll also find a list of relevant built-in functions (len(), concat(), etc.).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.