私は自分のプロジェクトで働いていますが、その機能の1つはテキストのみを取り消すことです(数字はそのままにしておくべきです)。たとえば、テキストこれはテストファイルですは elif tset a si sihTになります。数字を含む別の例USA 123 UAEは、になるはずです。EAU 123 ASU 次のプログラムを書いていますが、数字が含まれている行については結果が正しくありません(同じ行の英字が数字)。たとえば、正しい結果の代わりに米国123 UAEを取得しました。EAU 123 ASU。また、文クウェートイラク784バーレーンはniarhaB 784 qarI tiawuKでなければならないが、私は元のものを得た。だから、任意のヘルプや提案 この私のコード私はテキストを逆にする
FileName = "C:\Users\PC\Desktop\test.txt"
Dim AllTextFile As String = File.ReadAllText(FileName)
Dim objReader As New System.IO.StreamReader(FileName)
Dim seperatedWordsArray As String()
Dim allTextLines As String = ""
Dim tempTextLine As String = ""
Dim englishSentence As String = ""
Dim someSentences As New List(Of String)
Do While objReader.Peek() <> -1
TextLine = objReader.ReadLine()
tempTextLine = TextLine
englishSentence = ""
seperatedWordsArray = Regex.Split(TextLine, " "c)
For Each word As String In seperatedWordsArray
If (Regex.IsMatch(word, "^[a-zA-Z,.:]*$")) Then
englishSentence = englishSentence & word & " "
End If
Next
englishSentence = englishSentence.TrimEnd(" ") 'Remove the last space that added by the previous sentence englishSentence = englishSentence & word & " "
If (englishSentence.Length > 0) Then
tempTextLine = tempTextLine.Replace(englishSentence, StrReverse(englishSentence))
End If
allTextLines = allTextLines & tempTextLine & vbNewLine
Loop
TextBox2.Text = allTextLines</pre>
は、私は、次のテキストを使用して私のプログラムを試してみました:
これはテストファイルである
USA 123 UAE
トランプタワーNY 667
123 abcdef ABCDEF
、書、質問の種類、コマンドタイプ:
クウェートイラク784バーレーン
文は、文、質問、コマンドまたは感嘆
111センテンス454さまざまな種類777を表現する単語のグループであります感嘆符のタイプ
質問からすべてを削除し、**関連するものだけを**保持してください。あなたのコード/テキストの99%が質問に関連していません – Dekel