One way is to use Remix, the browser-based Solidity realtime compiler and runtime Solidity (formerly named browser-solidity).
- Paste the code in Remix.
- Wrap the function inside a
contractif needed. (Example:contract C { ... }.) - Click
Contracttab and thenCreateto instantiate the contract. - Enter the desired input next to the function.
- For
bytes1...bytes32, use a quoted hex string, example"0xabcdef"forbytes3. - For
bytes, use an array of hex strings, example:["0xab", "0xcd", "0xef"]. - For
strings, make sure they are quoted. - For large numbers, make sure they are quoted too.
- For an array, use
[], example:["hello", 42, "0xabcd"]
- Click the function to get the Result. The Result is ABI encoded.
Here is an example screenshot:
