Is there way of achieving this? I want to pass some text and have it appear on the input line -- instead of "Enter your Name:<cursor>", I want "Enter your Name:Default Editable Text<cursor>"
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Ok, found it. Sorry.
static void Main(string[] args)
{
Console.Write("Your editable text:");
SendKeys.SendWait("hello"); //hello text will be editable :)
Console.ReadLine();
}
回答2:
Assign the default value to your string and replace it only if the user has entered something.
Dim name, s As String
name = "John"
Console.Write($"Enter your Name (hit <Enter> for ""{name}""): ")
s = Console.ReadLine()
If Trim(s) <> "" Then
name = s
End If
Console.WriteLine("Result = {0}", name)
Console.ReadKey()