Всем привет! Что делает символ '\b' в C#?
Единственное использование которое я нашёл, это он может в одной строчке изменять символы без Console.Clear():
static void UpdateText(string text)
{
int commonPrefixLength = 0;
int commonLength = Math.Min(currentText.Length, text.Length);
while (commonPrefixLength < commonLength && text[commonPrefixLength] == currentText[commonPrefixLength])
{
commonPrefixLength++;
}
StringBuilder outputBuilder = new StringBuilder();
outputBuilder.Append('\b', currentText.Length - commonPrefixLength);
outputBuilder.Append(text.Substring(commonPrefixLength));
int overlapCount = currentText.Length - text.Length;
if (overlapCount > 0)
{
outputBuilder.Append(' ', overlapCount);
outputBuilder.Append('\b', overlapCount);
}
Console.Write(outputBuilder);
currentText = text;
}
\bhttps://ru.stackoverflow.com/a/1240063/373567 - смотрите в коде на методReadPassword. – aepot Dec 22 '21 at 11:52