如何将字符串分为三部分? [英] How do I divide a string into three parts ?

查看:122
本文介绍了如何将字符串分为三部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将一个字符串分成三部分。我使用以下代码。

I want to divide a string into three parts. I am using following code.

dim length1 as string
dim length2 as string
dim lenght3 as string
length1=Mid$(Text1.text,1,30)
length2=Mid$(Text1.text,30,70)
length3=Mid$(Text1.text,70,100)
msgbox length1
msgbox lenght2
msgbox length3





msgbox 2显示11,30的长度。为什么?



我尝试了什么:



有什么问题我的代码?我知道Mid $从字符串的左边开始。



msgbox 2 show me the length of 11,30. Why?

What I have tried:

What have wrong with my code? i know that Mid$ start at left of the string.

推荐答案

(Text1.text, 1 30
length2 = Mid
(Text1.text,1,30) length2=Mid


(Text1.text, 30 70
length3 = Mid
(Text1.text,30,70) length3=Mid


(Text1.text, 70 100
msgbox length1
msgbox lenght2
msgbox length3
(Text1.text,70,100) msgbox length1 msgbox lenght2 msgbox length3





msgbox 2显示我的长度为11,30。为什么?



我尝试了什么:



有什么问题我的代码?我知道Mid



msgbox 2 show me the length of 11,30. Why?

What I have tried:

What have wrong with my code? i know that Mid


这篇关于如何将字符串分为三部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆