Skip to content

Instantly share code, notes, and snippets.

Avatar

Dennison Bertram crazyrabbitLTC

View GitHub Profile
@crazyrabbitLTC
crazyrabbitLTC / StringToLower.sol
Created Jan 16, 2019 — forked from ottodevs/StringToLower.sol
Ethereum/Solidity toLower() equivalent, to transform strings to lowercase
View StringToLower.sol
pragma solidity ^0.4.11;
contract StringToLower {
function _toLower(string str) internal returns (string) {
bytes memory bStr = bytes(str);
bytes memory bLower = new bytes(bStr.length);
for (uint i = 0; i < bStr.length; i++) {
// Uppercase character...
if ((bStr[i] >= 65) && (bStr[i] <= 90)) {
// So we add 32 to make it lowercase