明天写给你,现在要熄灯了。
看来不用了,支持楼上的,简单可行。
哈哈,有了,想到一个更简单的。
dim Oldstring as string
dim StringNoSpaces as string
'去掉原串中的所有空格
StringNoSpaces = replace(Oldstring," ","")
NumOfSpaces = Len(OldString)-Len(StringNoSpaces)
这种方法其实是偷懒了,借助了Replace函数。
有关Replace函数的用法,表参阅参考资料页面。
参考资料:http://www.8esky.com/handbook/vb/function/Replace.html