forked from foxenergy456/BaseCamp
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9e57eba
commit 3890330
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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; | ||
} | ||
} |