zoukankan      html  css  js  c++  java
  • repeater处理字段内容过长截取显示内容函数

     '处理标题过长的标题,用………表示。  
        '参数dt_source表要修改的源表,str_title_column_name表作为标题的字段名,str_temp_title表去掉多余字符的字段名称,  
        'int_title_length表要显示的字符的长度。返回为一个datatable,它增加了一个名为str_temp_title的字段。  
        Public Function long_title(ByRef dt_source As DataTable, ByVal str_title_column_name As String, ByVal str_temp_title_column_name As String, ByVal int_title_lengh As Integer) As DataTable

            dt_source.Columns.Add(str_temp_title_column_name, System.Type.[GetType]("System.String"))
            Dim i As Integer = 0
            While i <= dt_source.Rows.Count - 1
                If dt_source.Rows(i)(str_title_column_name).ToString().Length > int_title_lengh + 1 Then
                    dt_source.Rows(i)(str_temp_title_column_name) = dt_source.Rows(i)(str_title_column_name).ToString().Substring(0, int_title_lengh + 1) + "……"
                Else

                    dt_source.Rows(i)(str_temp_title_column_name) = dt_source.Rows(i)(str_title_column_name)
                End If
                System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1)
            End While
            Return dt_source
        End Function

  • 相关阅读:
    Flask中的CBV以及正则表达式
    Flask中的渲染变量
    Flask中的request和response
    Flask中的cookie和session
    Flask的请求扩展
    [NOIP2000] 提高组 洛谷P1018 乘积最大
    [NOIP2000] 提高组 洛谷P1017 进制转换
    洛谷P2563 [AHOI2001]质数和分解
    巴蜀4384 -- 【模拟试题】作诗(Poetize)
    [NOIP1999] 提高组 洛谷P1016 旅行家的预算
  • 原文地址:https://www.cnblogs.com/services/p/1888946.html
Copyright © 2011-2022 走看看