大虾帮忙看看这段代码~

wanbolantian wanbolantian 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
'函数名: sdGetIniInfo
'功能:读取INI文件设置信息
'参数说明:iniFile-->INI文件 iniSection--INI文件中设置的部分名称
'作者:SD
'日期:2005-10-11
'Email:ztqas@126.com
'备注:转载或修改请保留此信息
Function sdGetIniInfo(ByVal iniFile As String, ByVal iniSection As String) As String
If Not File.Exists(iniFile) Then
Return "文件 " & iniFile & " 未找到,请确认路径和文件名是否正确!"
Exit Function
End If

Dim iniRead As New StreamReader(iniFile)
Dim iniStr As String = iniRead.ReadToEnd

Dim i As Integer
Dim cLine As Integer
Dim noSec As Boolean = False
Dim getValue As String = ""
Dim cLst

cLst = iniStr.Split(Chr(13))
cLine = UBound(cLst)

For i = 0 To cLine
If cLst(i).indexof("=") > 0 Then
If cLst(i).split("=")(0).trim() = iniSection Then
noSec = True
getValue = cLst(i).split("=")(1).trim()
Exit For
End If
End If
Next

If noSec = True Then
Return getValue
Else
Return "没有找到 " & iniSection & " 的设置信息!"
End If
End Function

这是在网上搜到的一段在Vb.net中读INI文件的代码,对红色代码部分不是很理解,
为什么在Split之后还能跟参数(0)呢,MSDN中关于Split的用法部分并没有提到这
么用的??那位大虾能解释一下红色代码是什么意思呢?先谢了
...全文
评论 6
收藏 已收藏
分享
返回顶部
wanbolantian
VB 16,718 成员 110,520 内容