css的ActiveX脚本 - C#中的右边函数

时间:2015-06-23 15:10:32

标签: c# activex

我想将下面的代码替换为c#。 右(“00”& ds.Tables [0] .Rows [0] [“KEY_NAME_VALUE”]。ToString()+ 1,3)

1 个答案:

答案 0 :(得分:0)

根据我的知识,C#中不存在 试试

String.Substring(ds.Tables[0].Rows[0]["KEY_NAME_VALUE"].ToString().Length - 3)

或者您可以使用Microsoft.VisualBasic

中的此功能
Public Function Right(ByVal [str] As String, ByVal Length As Integer) As String
            If Length < 0 Then
                Throw New ArgumentException(GetResourceString(ResID.Argument_GEZero1, "Length"))
            End If

            If Length = 0 OrElse [str] Is Nothing Then
                Return ""
            End If

            Dim lStrLen As Integer

            lStrLen = [str].Length

            If Length >= lStrLen Then
                Return [str]
            End If

            Return [str].Substring(lStrLen - Length, Length)
        End Function

http://referencesource.microsoft.com/#Microsoft.VisualBasic/Strings.vb,0dbb15fffce19341

然后你会依赖我假设的Microsoft.VisualBasic命名空间。