Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pragma solidity ^0.4.19;
- contract MyStringTest {
- function strConnect() public constant returns(string){
- string memory str1 = "abc";
- string memory str2 = "def";
- 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);
- }
- }
Add Comment
Please, Sign In to add comment