从数据库取数据时,带有回车/换行符替换方法

来源:互联网 发布:网络信息安全 编辑:程序博客网 时间:2024/06/05 06:30
    Public Shared Function delEnterCharForPrint2(ByVal     strValue As String) As String        Dim strReturn As String = strValue        '单引号(因为后面会加入单引号,所以必须先替换单引号)        strReturn = strReturn.Replace(Chr(39).ToString, "'+ String.fromCharCode(39) +'")        '替换回车符        strReturn = strReturn.Replace(Chr(10).ToString, "'+ String.fromCharCode(10) +'")        strReturn = strReturn.Replace(Chr(13).ToString, "'+ String.fromCharCode(13) +'")        strReturn = strReturn.Replace(Chr(92).ToString, "'+ String.fromCharCode(92) +'")        Return strReturn    End Function
0 0
原创粉丝点击