本文介绍了获取名称表单和输入框的首字母的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试输入框的首字母。
例如John Smith Brown我想要JSB
我尝试过:
I am trying to the initials form an input box.
for example John Smith Brown I want JSB
What I have tried:
Dim name As String
name = InputBox("Enter your name", "name")
Dim NameArr() As String
Dim i, initial As String
Dim count As Integer
i = ""
name = ""
nameArr = name.Split(" ")
For count = 0 To NameArr.Length - 1
i = NameArr.Substring(0, 1)
Next
推荐答案
Dim name As String
name = InputBox("Enter your name", "name")
Dim NameArr() As String
Dim i, initial As String
Dim count As Integer
i = ""
name = "" ' error: this line clear the contain of name, remove
nameArr = name.Split(" ")
For count = 0 To NameArr.Length - 1
i = NameArr.Substring(0, 1) ' error, replace with
i = i + NameArr.Substring(0, 1)
Next
这篇关于获取名称表单和输入框的首字母的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!