     function substring(string _str, uint _startIndex, uint _endIndex) public pure returns (string) {
         bytes memory strBytes = bytes(_str);
         require(_startIndex <= _endIndex);
         require(_startIndex >= 0);
         require(_endIndex <= strBytes.length);
         bytes memory result = new bytes(_endIndex - _startIndex);
         for (uint i = _startIndex; i < _endIndex; i++) {
             result[i - _startIndex] = strBytes[i];
         }
         return string(result);
     }