我需要帮助使一个功能,打开一个文件,并为每一个新行,在PHP中使像explode("\n", $var)
变量。我试过VB.NET对于每一个新行
Dim words As String = GetFileContents(OpenFileDialog1.FileName)
For Each word As String In words
Dim doHash As String = MD5(word)
If String.Equals(doHash, hash.Text) Then
Label2.Text = "derp"
Else
Label2.Text = "lol"
End If
Next
但它使每个字母成为一个新的变量。
您可能正在寻找['String.Split'](http://msdn.microsoft.com/zh-CN/library/tabh47cf%28v=vs.100%29.aspx)。以下是C#中爆炸的示例:http://www.dotnetperls.com/explode-function – 2012-04-26 17:52:55
您可以提供'GetFileContents'的代码吗?它看起来像是将值作为单个String而不是String的数组返回。如果你要迭代它们,你需要一个数组。 – mellamokb 2012-04-26 17:52:57
阅读['String.Split'](http://msdn.microsoft.com/en-us/library/system.string.split.aspx)和/或['File.ReadLines'](http:///msdn.microsoft.com/en-us/library/dd383503.aspx)。 – vcsjones 2012-04-26 17:53:14