prompt

Easy general-purpose function to prompt user for input. Optionally supports custom validation.

Get input from the user: auto result = prompt("Enter Text>");

Get validated input. Won't return until user enters valid input: bool accept(string input) { input = toLower(input); return input == "coffee" || input == "tea"; } auto result = prompt("What beverage?", &accept, "Not on menu, try again!");

string
prompt
(
string promptMsg
,
bool delegate(
const(char)[]
)
accept = null
,
string rejectedMsg = ""
)

Meta