预览模式: 普通 | 列表

vb.net判断重复文本并提取

Dim data As New List(Of String) ' 保存2000000条数据的列表
' 假设数据已经保存在 data 列表中

Dim countDict As New Dictionary(Of String, Integer) ' 字典用于保存每条数据的重复次数

For Each item As String In data
If countDict.ContainsKey(item) Then
countDict(item) += 1 ' 如果字典中已经存在这条数据,重复次数加1
Else
countDict(item) = 1 ' 如果字典中不存在这条数据,添加到字典中并初始化重复次数为1
End If
Next

' 输出重复次数大于1的数据
For Each item As KeyValuePair(Of String, Integer) In countDict
If item.Value > 1 Then
Console.WriteLine("{0}: {1}", item.Key, item.Value)
End If
Next

Tags: vb.net

分类:技术文章 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 542

vb.net正则判断ip端口格式

Dim ip As String = "192.168.0.1"

' 创建正则表达式对象
Dim regex As New System.Text.RegularExpressions.Regex("^(\d{1,3}\.){3}\d{1,3}$")

' 判断是否是 IP 地址
If regex.IsMatch(ip) Then
Console.WriteLine("The string is an IP address.")
Else
Console.WriteLine("The string is not an IP address.")
End If


Dim ipAndPort As String = "192.168.0.1:8080"

查看更多...

Tags: vb.net

分类:技术文章 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 468

vb.net多线程下载

 Imports System.IO
Imports System.Net
Imports System.Threading

Public Class Form1
Private downloadThreads As List(Of Thread) = New List(Of Thread)()
Private downloadUrls As List(Of String) = New List(Of String)()

Private proxy As WebProxy = New WebProxy("http://proxy.example.com:8080")
Private threadCount As Integer = 10

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' 添加需要下载的网址
For i As Integer = 1 To 10000
downloadUrls.Add("http://example.com/file" & i & ".jpg")
Next
End Sub

查看更多...

Tags: vb.net

分类:技术文章 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 554

vb.net多线程下载

Imports System.IO
Imports System.Net
Imports System.Threading

Public Class Form1
Private downloadThreads As List(Of Thread) = New List(Of Thread)()
Private downloadUrls As List(Of String) = New List(Of String)()

Private proxy As WebProxy = New WebProxy("http://proxy.example.com:8080")
Private threadCount As Integer = 10

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' 添加需要下载的网址
For i As Integer = 1 To 10000
downloadUrls.Add("http://example.com/file" & i & ".jpg")
Next
End Sub

查看更多...

Tags: vb.net

分类:技术文章 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 536

vb.net多线程下载

Imports System.IO
Imports System.Net
Imports System.Threading

Public Class Form1
Private downloadThreads As List(Of Thread) = New List(Of Thread)()
Private downloadUrls As List(Of String) = New List(Of String)()

Private proxy As WebProxy = New WebProxy("http://proxy.example.com:8080")

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' 添加需要下载的网址
downloadUrls.Add("http://example.com/file1.jpg")
downloadUrls.Add("http://example.com/file2.jpg")
downloadUrls.Add("http://example.com/file3.jpg")
downloadUrls.Add("http://example.com/file4.jpg")
downloadUrls.Add("http://example.com/file5.jpg")
End Sub

查看更多...

Tags: vb.net

分类:技术文章 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 462

 广告位

↑返回顶部↑