VB.NET中如何识别字符串中的重复序列片段?
- 内容介绍
- 文章标签
- 相关推荐
本文共计616个文字,预计阅读时间需要3分钟。
在VB.Net中,要找到字符串中的重复序列,可以使用以下方法:
vbDim inputString As String=EDCRFVTGBEDCRFVTGBEDCRFVTGBEDCRFVTGBEDCRFVTGBEDCRFVTGBDim repeatSequence As String=EDCRFVTGBDim count As Integer=0
For i As Integer=0 To inputString.Length - repeatSequence.Length If inputString.Substring(i, repeatSequence.Length)=repeatSequence Then count +=1 End IfNext
Console.WriteLine(重复序列 ' & repeatSequence & ' 出现了 & count & 次。
本文共计616个文字,预计阅读时间需要3分钟。
在VB.Net中,要找到字符串中的重复序列,可以使用以下方法:
vbDim inputString As String=EDCRFVTGBEDCRFVTGBEDCRFVTGBEDCRFVTGBEDCRFVTGBEDCRFVTGBDim repeatSequence As String=EDCRFVTGBDim count As Integer=0
For i As Integer=0 To inputString.Length - repeatSequence.Length If inputString.Substring(i, repeatSequence.Length)=repeatSequence Then count +=1 End IfNext
Console.WriteLine(重复序列 ' & repeatSequence & ' 出现了 & count & 次。

