K
K
Kramnikk2021-05-07 21:25:42
C++ / C#
Kramnikk, 2021-05-07 21:25:42

How to display text in a column in TelegramBot?

Example:
609582deb0eee361042058.png

Tried by analogy with the console application, but this result does not work.

The code:

WebClient webc = new WebClient();
            string strhtml = webc.DownloadString("https://www.cbr-xml-daily.ru/daily_utf8.xml");

            string str = $"{"Валюта",-25}{"Номинал",-10}{"Курс",-7}";

            Regex regex = new Regex(@"<CharCode>EUR</CharCode><Nominal>(.*?)</Nominal><Name>Евро</Name><Value>(.*?)</Value>");
            Match match = regex.Match(strhtml);
            str += $"\n{"Евро",-25}{match.Groups[1],-10}{match.Groups[2],-7}";

            regex = new Regex(@"<CharCode>USD</CharCode><Nominal>(.*?)</Nominal><Name>Доллар США</Name><Value>(.*?)</Value>");
            match = regex.Match(strhtml);
            str += $"\n{"Доллар США",-25}{match.Groups[1],-10}{match.Groups[2],-7}";

            Console.WriteLine(str);

6095837e95abd256737358.png
60958532352e7953579138.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya, 2021-05-07
@Kramnikk

Try adding a monospace modifier to the post

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question