首先致敬各位创作者,辛苦了!有了你们的贡献,才让程序园充满生机!

这篇文章简单讲述了一些编辑器的使用方法,仅供参考。

1,工具栏

编辑器顶部有个工具条,可以对文字进行一些修饰

2,区块模板

在工具栏的左边第一个按钮可以打开区块模板,插入一些高级板块

3,代码块

首先点开区块列表,先择 IO高亮代码 ,就可以看到编辑器出现了一个代码框框,然后粘贴代码进去,

然后在右边的区块编辑里面选择正确的代码语言,发布之后才能正常渲染语法。

发布文章之后,就可以看到下面的代码效果了,语法高亮,行号显示,

在代码窗口右上角可以点击复制按钮,把代码复制到剪贴板使用。

Attribute VB_Name = "mStr"
Option Explicit

Public Function GetNewIds(Optional ByVal Bath As Long)
    GetNewIds = "开发中..."
End Function

Public Function GetFirstChar(Txt As String, Optional length As Long = 1) As String
    Dim Pos As Long, CharStr As String, CharDec As Long
    Do Until (CharDec >= 33 And CharDec <= 126)
        Pos = Pos + 1
        CharStr = Mid$(Txt, Pos, 1)
        CharDec = Asc(CharStr)
    Loop
    If length = 1 Then
        GetFirstChar = CharStr
    Else
        GetFirstChar = Mid$(Txt, Pos, length)
    End If
End Function

Public Function GetLastChar(Txt As String, Optional length As Long = 1) As String
    Dim Pos As Long, CharStr As String, CharDec As Long
    Do Until (CharDec >= 33 And CharDec <= 126)
        Pos = Pos + 1
        CharStr = Mid$(Txt, Pos, 1)
        CharDec = Asc(CharStr)
    Loop
    If length = 1 Then
        GetLastChar = CharStr
    Else
        GetLastChar = Mid$(Txt, Pos, length)
    End If
End Function

Public Function GetRandStr(Optional ByVal Lens As Integer = 32, Optional Zuhe As String = "1aA") As String
    Rem 先顶用下,后期优化
    '取的随机字符串,组合参数支持  1aA@
    Rem 有时间可以开1000个线程并行计算,看看跑多长时间会出现重复,
    Rem 以 8 位 1aA 参数测试,32位字符重复率视为零
    '制作:2016-01-21   邓伟
    Dim Chars As String, i As Long, Max As Long, C As String, Pos As Long
    Dim Char As String
    Dim C1 As String: C1 = "0123456789"
    Dim xA As String: xA = "abcdefghijklmnopqrstuvwxyz"
    Dim dA As String: dA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    Dim CO As String: CO = "!""#$%&'()*+,-./:;<=>?@[\]^_`{|}~"
    If Zuhe = "" Then
        Chars = C1 & xA & dA & CO
    Else
        If InStr(Zuhe, "1") > 0 Then Chars = Chars & C1
        If InStr(Zuhe, "a") > 0 Then Chars = Chars & xA
        If InStr(Zuhe, "A") > 0 Then Chars = Chars & dA
        If InStr(Zuhe, "@") > 0 Then Chars = Chars & CO
    End If
    If Lens < 1 Then Lens = 8
    Max = Len(Chars)
    For i = 1 To Lens
        Pos = mMath.GetRandRange(1, Max)
        C = Mid$(Chars, Pos, 1)
        Char = Char & C
        '        Debug.Print i, C, Max, Pos
    Next
    GetRandStr = Char
End Function

最后,有其他不明白的地方,请在评论区留言,我这里会更新简介。


Views: 63

Hi, I’m 邓伟

本来无一物,何处惹尘埃

3 Comments

发表回复