Imports System.IO
Imports System.Text.RegularExpressions
Public Class Form1
Public getcountry As String
Public getcombos As String
Public int_2 As Integer
Public string_2 As String() = New String(0 - 1) {}
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim getcombo As String
If unformat.Text.Contains("Okcupid") Then
Else
MessageBox.Show("Please put ""Okcupid"" in first line of unformatted text or it won't work")
Exit Sub
End If
Try
If unformat.Text.Contains("Subscription: false ") Then
textbox_goods.Text += "Okcupid(Unpaid)"
Else
textbox_goods.Text += ("Okcupid(Paid)")
End If
If unformat.Text.Contains("Country: US") Then
textbox_goods.Text += "|US|,"
Else
textbox_goods.Text += "|US|,"
End If
If unformat.Text.Contains("Subscription: false ") Then
textbox_goods.Text += "Unpaid Account,"
Else
textbox_goods.Text += "Paid Account,"
End If
getcountry = Form1.smethod_0(unformat.Text, ",", "Country:")
If unformat.Text.Contains("Okcupid") Then
getcombo = Form1.smethod_0(unformat.Text, "Okcupid", ",")
End If
textbox_goods.Text += getcountry
textbox_goods.Text += (" Country: US|okcupid.com|" & getcombo)
int_2 += 1
Finally
End Try
End Sub
Public Shared Function smethod_0(ByVal string_6 As String, ByVal string_7 As String, ByVal string_8 As String) As String
On Error Resume Next
Return Regex.Match(string_6, (string_7 & "(.*?)" & string_8)).Groups.Item(1).Value
End Function
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Try
If textbox_goods.Lines.Count = Nothing Then : Exit Sub
End If
Dim ID As New SaveFileDialog
ID.Title = "Save Formatted Text"
ID.Filter = "Files TXT (*.txt)|*.txt|All Files (*.*)|*.*"
ID.FileName = "Formatted"
If ID.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim I As New StreamWriter(ID.FileName)
For P As Integer = 0 To textbox_goods.Lines.Count - 1
I.WriteLine(textbox_goods.Text(P))
Next
I.Close()
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
MessageBox.Show("Please input 1 line each don't stack all it might not output the formatted correctly please put ""Okcupid"" in the first line of combo")
End Sub
End Class
此代码的作用是我将格式化未格式化的内容
[Unformatted]
Okcupidexample@yahoo.com:example123, Subscription: false / Gender: 2 / Age: 27 / DOB: 681782400ZIP: 19123 / Country: US
[Formatted]
Okcupid(Unpaid)|US|,Unpaid Account, Subscription: false / Gender: 2 / Age: 27 / DOB: 681782400ZIP: 19123 / Country: US|okcupid.com|example@yahoo.com:example123
我放在顶部的未格式化只是一行,我需要做的是如何使它在多行上工作,而不仅仅是一次,而是多次。
我的下一个问题是,我需要在email:pass的第一行中添加“ Okcupid”,以便它可以捕获到这两个。