Skip to content

Bunch of random shit in solidity e.g StringMethod Library which allows you various method not present in solidity

License

Notifications You must be signed in to change notification settings

malik672/sol-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sol-utils

Bunch of random shit in solidity

StringMethod Library

This is a Solidity library that provides various methods for working with strings. The library contains the following functions:

Concatenate: This function joins two strings together.

Usage

// import
import  "./stringMethod.sol";

contract MyContract {

    function joinThestrings(string memory a, string memory b) public pure returns (string memory) {

        return stringMethod.concatenate(a, b);

    }

}

Matches: This function checks an array of strings return 1 if present else 0.

Usage

// import
import "./stringMethod.sol";

contract MyContract {

    function matchTheString(string[] memory arr, string memory check) public pure returns (uint256) {

        return stringMethod.matches(arr, check);

    }

}

Slice: This function slice and return the sliced string.

Usage

// import
import { stringMethod } from "./stringMethod.sol";

contract MyContract {

    function sliceTheString(uint256 start, uint256 end) public pure returns (string memory){

        return stringMethod.slice(start,end);

    }

}

NOTE: This methods modify the original string in memory, once you use them the original strings no longer exist

About

Bunch of random shit in solidity e.g StringMethod Library which allows you various method not present in solidity

Resources

License

Stars

Watchers

Forks