Skip to content

CommandStringHelper ​

final class · pocketmine\command\utils\CommandStringHelper · source

Methods ​

parseQuoteAware() ​

php
public static function parseQuoteAware(string $commandLine) : array

Parses a command string into its component parts. Parts of the string which are inside unescaped quotes are considered as one argument.

Examples:

  • give "steve jobs" apple -> ['give', 'steve jobs', 'apple']
  • say "This is a \"string containing quotes\"" -> ['say', 'This is a "string containing quotes"']
  • kill @e[type=cow, name="Big Bob"] -> ['kill', '@e[type=cow, name="Big Bob"]'] (target selectors keep their arguments together, unchanged, like Bedrock)

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.