Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pragma solidity ^0.4.0;
- import "github.com/20Scoops-CNX/solidity-utils/lib/ListInteger.sol";
- import "github.com/20Scoops-CNX/solidity-utils/lib/Strings.sol";
- import "github.com/20Scoops-CNX/solidity-utils/lib/Integers.sol";
- contract ExampleContract {
- using ListInteger for *;
- using Strings for string;
- using Integers for uint;
- uint[] public items;
- function exist(uint[] items, uint value) public returns (bool) {
- uint i = 0;
- while (i<items.getSize() && items[i] != value) {
- i++;
- }
- if(i>=items.getSize())
- return false;
- else if( items[i] == value)
- return true;
- }
- function example(uint c) public returns (uint, uint) {
- uint size1 = items.getSize();
- if(exist(items,c)){
- items.removeByValue(c);
- }
- uint size2 = items.getSize();
- return (size1,size2);
- }
- function example1() public {
- items.add(1);
- items.add(2);
- items.add(4);
- items.add(3);
- // uint index = items.find(9911);
- // return index;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement