C# 如何在阅读SpeechSynthesizer C时忽略特定字符?

C# 如何在阅读SpeechSynthesizer C时忽略特定字符?,c#,output,voice,speech-synthesis,C#,Output,Voice,Speech Synthesis,我有一些字符串,如下所示 TEST___5____345 如何使SpeechSynthesizer在阅读时忽略下划线字符,因为这很烦人?下面的代码使用下划线作为分隔符拆分字符串。添加StringSplitOptions.RemoveEmptyEntries将删除inputstring中有多个连续下划线时可能出现的所有空字符串 using System; namespace IgnoreUnderscore { class Program { static vo

我有一些字符串,如下所示

TEST___5____345

如何使SpeechSynthesizer在阅读时忽略下划线字符,因为这很烦人?

下面的代码使用下划线作为分隔符拆分字符串。添加StringSplitOptions.RemoveEmptyEntries将删除inputstring中有多个连续下划线时可能出现的所有空字符串

using System;

namespace IgnoreUnderscore
{
    class Program
    {
        static void Main(string[] args)
        {
            var str ="TEST___5____345";

            var arr = str.Split(new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries);

            for (int i = 0; i < arr.Length; i++)
            {
                Console.WriteLine(arr[i]);
            }

            Console.ReadKey();
        }
    }
}

在读取之前更改字符串
TEST
5
345