//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f. pragma solidity ^0.4.18; contract SimpleStore { mapping(address => mapping(uint => string)) addressToIdToMsg; mapping(address => uint) idToStoreCnt; string delimiter = "/"; function setMsg(string _msg) public { uint cnt = idToStoreCnt[msg.sender]; addressToIdToMsg[msg.sender][cnt] = _msg; idToStoreCnt[msg.sender]++; } function getMyAllMsg() public view returns(string) { string memory ret; string memory buf; uint storeLen = idToStoreCnt[msg.sender]; for(uint i=0; i<storeLen; i++){ buf = addressToIdToMsg[msg.sender][i]; ret = _strConnect(ret, delimiter); ret = _strConnect(ret, buf); } return ret; } function _strConnect(string str1, string str2) private pure returns(string) { bytes memory strbyte1 = bytes(str1); bytes memory strbyte2 = bytes(str2); bytes memory str = new bytes(strbyte1.length + strbyte2.length); uint8 point = 0; for(uint8 j = 0; j < strbyte1.length;j++){ str[point] = strbyte1[j]; point++; } for(uint8 k = 0; k < strbyte2.length;k++){ str[point] = strbyte2[k]; point++; } return string(str); } }
0.4.18