Skip to content

Commit

Permalink
Create Imports
Browse files Browse the repository at this point in the history
  • Loading branch information
harsharock authored Apr 28, 2024
1 parent 9e57eba commit 3890330
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Imports
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;
}
}

0 comments on commit 3890330

Please sign in to comment.