📄 common.vb
字号:
'******************************************************************************************
'ConvertString 类,用来转换字符串
'********************************************************************************************
Imports System
Imports System.Configuration '因为用到了ConfigurationSettings类
Imports Microsoft.Visualbasic
Imports System.Web
Imports System.Text.RegularExpressions '因为要用正则表达式,所以导入
'----------------------------------------------------------------------
'第1个类,用来转换字符串
Public Class ConvertString 'ConvertString是自己定义的类的名称
'下面定义一个属性,表示该类的版本号
Public Version As String="1.0"
'该函数用来显示HTML代码和换行显示
Public Shared Function HTMLEncode(strInput As String) As String
If strInput<>"" Then
strInput=Replace(strInput,"&","&") '替换&
strInput=Replace(strInput,"<","<") '替换<
strInput=Replace(strInput,">",">") '替换>
strInput=Replace(strInput,chr(10),"<br>") '替换换行符
strInput=Replace(strInput,chr(32)," ") '替换空格符
strInput=Replace(strInput,chr(9)," ") '替换Tab制表符
End If
HTMLEncode=strInput '返回函数值
End Function
'该函数用来显示UBB代码
Public Shared Function UBBEncode(strInput As String) As String
If strInput<>"" Then
'依次6句依次替换斜体、粗体、下划线、图片、超链接、Email
strInput = Regex.Replace(strInput, "(?:\[i\])(?<body>[^\[]+)(?:\[/i\])", "<i>${body}</i>", RegexOptions.IgnoreCase)
strInput = Regex.Replace(strInput, "(?:\[b\])(?<body>[^\[]+)(?:\[/b\])", "<b>${body}</b>", RegexOptions.IgnoreCase)
strInput = Regex.Replace(strInput, "(?:\[u\])(?<body>[^\[]+)(?:\[/u\])", "<u>${body}</u>", RegexOptions.IgnoreCase)
strInput = Regex.Replace(strInput, "(?:\[img\])(?<body>[^\[]+)(?:\[/img\])", "<img src=""${body}"">", RegexOptions.IgnoreCase)
strInput = Regex.Replace(strInput, "(?:\[url\])(?<body>[^\[]+)(?:\[/url\])", "<a href=""${body}"" target=""_blank"">${body}</a>", RegexOptions.IgnoreCase)
strInput = Regex.Replace(strInput, "(?:\[email\])(?<body>[^\[]+)(?:\[/email\])", "<a href=""mailto:${body}"">${body}</a>", RegexOptions.IgnoreCase)
End If
UBBEncode = strInput '返回函数值
End Function
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -