-
Notifications
You must be signed in to change notification settings - Fork 327
/
imports.sol
35 lines (28 loc) · 1.17 KB
/
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
// SPDX-License-Identifier: MIT
// Importing the SillyStringUtils library
import "./SillyStringUtils.sol";
pragma solidity 0.8.17;
contract ImportsExercise {
// Using the SillyStringUtils library for string manipulation
using SillyStringUtils for string;
// Declaring a public variable to store a Haiku
SillyStringUtils.Haiku public haiku;
// Function to save a Haiku
function saveHaiku(string memory _line1, string memory _line2, string memory _line3) public {
haiku.line1 = _line1;
haiku.line2 = _line2;
haiku.line3 = _line3;
}
// Function to retrieve the saved Haiku
function getHaiku() public view returns (SillyStringUtils.Haiku memory) {
return haiku;
}
// Function to append a shrugging emoji to the third line of the Haiku
function shruggieHaiku() public view returns (SillyStringUtils.Haiku memory) {
// Creating a copy of the Haiku
SillyStringUtils.Haiku memory newHaiku = haiku;
// Appending the shrugging emoji to the third line using the shruggie function from the SillyStringUtils library
newHaiku.line3 = newHaiku.line3.shruggie();
return newHaiku;
}
}