-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path8-Imports.sol
38 lines (29 loc) · 1008 Bytes
/
8-Imports.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
library SillyStringUtils {
struct Haiku {
string line1;
string line2;
string line3;
}
function shruggie(string memory _input) internal pure returns (string memory) {
return string.concat(_input, unicode" 🤷");
}
}
contract ImportsExercise {
using SillyStringUtils for SillyStringUtils.Haiku;
SillyStringUtils.Haiku public haiku;
function saveHaiku (string memory _line1, string memory _line2, string memory _line3) public {
haiku.line1 = _line1;
haiku.line2 = _line2;
haiku.line3 = _line3;
}
function getHaiku() public view returns(SillyStringUtils.Haiku memory) {
return haiku;
}
function shruggieHaiku() public view returns (SillyStringUtils.Haiku memory) {
SillyStringUtils.Haiku memory modifiedHaiku = haiku;
modifiedHaiku.line3 = SillyStringUtils.shruggie(haiku.line3);
return modifiedHaiku;
}
}