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

euri10
  • 4,640
  • 5
  • 24
  • 55

1 Answers1

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

eth
  • 85,679
  • 53
  • 285
  • 406