大家帮我看看这个函数啥意思啊 '自定义format函数Private Function FormatStr(SourceStr As String,FormatString As String) As StringDim i As LongDim tempstr As StringDim iLen As LongDim FormatLen As LongDim DecLen As LongFormatLen = Len(
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/23 18:48:53
大家帮我看看这个函数啥意思啊 '自定义format函数Private Function FormatStr(SourceStr As String,FormatString As String) As StringDim i As LongDim tempstr As StringDim iLen As LongDim FormatLen As LongDim DecLen As LongFormatLen = Len(
大家帮我看看这个函数啥意思啊
'自定义format函数
Private Function FormatStr(SourceStr As String,FormatString As String) As String
Dim i As Long
Dim tempstr As String
Dim iLen As Long
Dim FormatLen As Long
Dim DecLen As Long
FormatLen = Len(FormatString)
iLen = Len(SourceStr)
If FormatLen >= iLen Then
DecLen = FormatLen - iLen
tempstr = Left(FormatString,DecLen) & SourceStr
Else
tempstr = Left(SourceStr,FormatLen)
End If
FormatStr = tempstr
End Function
大家帮我看看这个函数啥意思啊 '自定义format函数Private Function FormatStr(SourceStr As String,FormatString As String) As StringDim i As LongDim tempstr As StringDim iLen As LongDim FormatLen As LongDim DecLen As LongFormatLen = Len(
就是将字符串长度与一标准字符串长度比较,
如果字串长度比标准的长,则保留到标准的长度即可;
如时字串长度比标准的短,则在其之前添加标准字串的前几位补足同样的长度.
有道理