Questions tagged [slice]

A slice is a representation of a part of a sequence, usually defined by a reference to the underlying sequence, an index giving the starting position, a length or end position.

Filter by
Sorted by
Tagged with
2 votes
1 answer
44 views

Why can you slice bytes in calldata but not in memory?

If trying to slice bytes in memory one gets the error below. The solidity docs give no explanation just state that array slices are only supported for calldata as of now. TypeError: Index range access ...
FreddyC's user avatar
  • 181
1 vote
1 answer
815 views

How do I slice my arrays in Solidity?

I need help! Kindly bare with me as I am new to Solidity. I am trying to use the slice array method to remove the first element in my array while also decreasing the array length. I have a function ...
SirBT's user avatar
  • 147
1 vote
1 answer
2k views

How to split a string in solidity?

I'm using the OpenZeppelin Preset of the 1155 Token Standard. (https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts/token/ERC1155/presets) I'm able to mint tokens with that and ...
Matthias Härle's user avatar
12 votes
1 answer
14k views

How can I slice bytes, strings, and arrays in Solidity?

Is it possible to slice variables in Solidity?
Shane Fontaine's user avatar