如何计算VB6字符串中的字符而不包含空格?

0 string vb6

在不包含空格的情况下计算Vb6中的字符(字符串)

Bon*_*ond 5

只需使用Len()Replace()检索字符串的长度并删除空格.例如:

Const strText As String = "The    quick brown  fox"

Debug.Print "Original length:   " & Len(strText)                     ' => 23
Debug.Print "Length w/o spaces: " & Len(Replace$(strText, " ", ""))  ' => 16
Run Code Online (Sandbox Code Playgroud)