3

I was reading an interesting answer and wanted to make a quick test in browser-solidity.

My contract code is below and I'd just like to get the string I passed in the constructor.

contract testConstant{
string testString;
// {"_testString":"this is a test"}
function testConstant(string _testString) {
    testString=_testString;
}
function gettestString() public constant returns(string) {
    return testString;
}
}

Attached a screenshot, maybe I'm overlooking something but it seems to me the gettestString in blue should return the arg I passed in the constructor : "this is a test"

enter image description here

1 Answer 1

2

Your example works on latest Solidity version: 0.3.3-4dc1cb14/Release-Emscripten/clang/Interpreter

"0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000e7468697320697320612074657374000000000000000000000000000000000000"

Cost: 805 gas. (caveat)

Decoded: string: this is a test

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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