0
Public Function StartTableCell( _
  Optional ByVal align As String = "", _
  Optional ByVal valign As String = "", _
  Optional ByVal colspan As String = "", _
  Optional ByVal rowspan As String = "", _
  Optional ByVal width As String = "", _
  Optional ByVal height As String = "") As String

    Dim _StrBuil As New StringBuilder()

End Function

如何显示调用者传入值的参数中的值?例如,如果align""不应该显示。

4

1 回答 1

0

StringBuilder最简单的方法是检查每个参数并逐个构建。

例如:

Dim _StrBuil As New StringBuilder()
If Not String.IsNullOrEmpty(align)
    _StrBuil.Append(("align: """ + align + """")
End If
If Not String.IsNullOrEmpty(valign)
    _StrBuil.Append(("valign: """ + valign + """")
End If 
'etc.  
Return "<td " + _StrBuil.ToString + ">"
于 2012-09-04T13:55:20.293 回答