当前位置:好百科>百科知识>vbmid函数的使用方法

vbmid函数的使用方法

2025-03-22 18:17:38 编辑:zane 浏览量:549

vbmid函数的使用方法

的有关信息介绍如下:

vbmid函数的使用方法

从贴出来的图片看,与Mid()函数无关。Mid("abcde",2,2) ——"bc" Mid("abcde",2) ——"bcde" MSDN,最好的示例: Dim MyString, FirstWord, LastWord, MidWordsMyString = "Mid Function Demo" ' Create text string.FirstWord = Mid(MyString, 1, 3) ' Returns "Mid".LastWord = Mid(MyString, 14, 4) ' Returns "Demo".MidWords = Mid(MyString, 5) ' Returns "芹启亮Function Demo".The second example use MidB and a user-defined function (MidMbcs) to also return characters from string. The difference here is that the input string is ANSI and the length is in bytes.Function MidMbcs(ByVal str as String, start, length) MidMbcs = StrConv(MidB(StrConv(str, vbFromUnicode), start, length), vbUnicode)End FunctionDim MyStringMyString = "AbCdEfG"' Where "A", "C"旁枝, "嫌宽E", and "G" are DBCS and "b", "d", ' and "f" are SBCS.MyNewString = Mid(MyString, 3, 4)' Returns ""CdEf"MyNewString = MidB(MyString, 3, 4)' Returns ""bC"MyNewString = MidMbcs(MyString, 3, 4)' Returns "bCd"

版权声明:文章由 好百科 整理收集,来源于互联网或者用户投稿,如有侵权,请联系我们,我们会立即处理。如转载请保留本文链接:https://www.haobaik.com/article/294383.html
热门文章