pragma solidity ^0.5.0; contract ListGestionB{ //event OnCreateList(address _from, uint256 _value); struct ListBlanche { string ip; string t; } uint numList; ListBlanche[] public ListBlanches; //mapping (uint => ListBlanche) listBlanches; //function createList function AjouterList(string _ip,string _t) public returns(uint listID) { listID=numList++; ListBlanches.push( ListBlanche({ ip:_ip, t:_t }) ); //OnCreateList(msg.sender,listID); } //function supprimer ip function SupprimerList(string _ipN)public { for(uint i=0;i<ListBlanches.length;i++){ bytes memory a= bytes(ListBlanches[i].ip); bytes memory b=bytes(_ipN); if(a.length==b.length){ for(uint y=0;y<a.length;y++){ if(a[y]!=b[y]){ } else{ ListBlanches[i].ip="null"; //OnCreateList(msg.sender,i); } } } } } //function retourner IP function GetIp(uint id) public returns(string Ip,string Type){ return (ListBlanches[id].ip,ListBlanches[id].t); } }
0.4.11