-
-
Notifications
You must be signed in to change notification settings - Fork 103
Expand file tree
/
Copy pathstringMatch.sol
More file actions
31 lines (26 loc) · 750 Bytes
/
stringMatch.sol
File metadata and controls
31 lines (26 loc) · 750 Bytes
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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title String Matching.
* @author [Sreek](https://github.com/sreekar9601)
* @dev Contract to demonstrate matching of two strings.
*/
contract StringMatch {
string firstString;
string secondString;
function setFirstString(string memory _firstString) public {
firstString = _firstString;
}
function setSecondString(string memory _secondString) public {
secondString = _secondString;
}
function stringMatch() public view returns (bool) {
if (
keccak256(abi.encodePacked(firstString)) ==
keccak256(abi.encodePacked(secondString))
) {
return true;
}
return false;
}
}