Minecraft wiki entry for clear, associated text: To clear your entire inventory: clear
To clear all items from Alice's inventory: clear Alice
To clear all wool items from Alice's inventory: clear Alice minecraft:wool
To clear all orange wool items from the inventory of all players: clear @a minecraft:wool 1‌[Bedrock Edition only] or clear @a minecraft:orange_wool‌[Java Edition only]
To clear all golden swords with the "Sharpness I" enchantment from the nearest player
clear @p minecraft:golden_sword{Enchantments:[{id:"minecraft:sharpness",lvl:1s}]}‌[Java Edition only]
To test if a random player has stone in their inventory: clear @r minecraft:stone -1 0‌[Bedrock Edition only] or clear @r minecraft:stone 0‌[Java Edition only]