string str = "123456789";
System.Text.StringBuilder result = new System.Text.StringBuilder();
for(int i = 0; i < str.Length; i++)
result.Append(i % 4 == 0 && i > 0? $"-{str[i]}" : $"{str[i]}");
Console.WriteLine($"{result}");
<Window... xmlns:xctk="http://schemas.microsoft.com/expression/blend/2008" ../>
webbrowser.Navigated += (sendr, ee) =>
{
if (ee.Uri.ToString().Contains("https://oauth.vk.com/blank.html#access_token="))
{
token = ee.Uri.ToString().Substring(45);
token = token.Remove(token.IndexOf('&'));
}
};