字串变数组的问题(急....)

sdpong 2001-12-05 05:43:00
我们知道在vc java中都有直接将字串转数组的函数,可是要在vb中,请问如何实现,请写出代码...
...全文
107 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
I_168_888 2001-12-06
  • 打赏
  • 举报
回复
dim str as string
dim arr() as byte
arr=StrConv(str, vbFromUnicode)
简单啊,考虑我的问题:如何把ListBox绑定到ADO数据集?
sdpong 2001-12-06
  • 打赏
  • 举报
回复
哪有那么简单没有分割符
要求中文也能分割成单字节的字符


不要把我想得那样菜

不过我对vb确实很菜

sonicdater 2001-12-05
  • 打赏
  • 举报
回复
如果 你能 确定 分割符,就用 split 函数。
其它嘛,就麻烦了。 就用 遍历 这个字符串,然后 逐个 存在 数组中吧。

split 函数 用法:
===================
Dim strTmp
ReDim Array()

strTmp = "I/AM/A/BEGINNER"
Array = Split(strTmp,"/")

===================
Array(0) = "I"
Array(1) = "AM"
Array(2) = "A"
……………………

==============================
Description

Returns a zero-based, one-dimensional array containing a specified number of substrings.

Syntax

Split(expression[, delimiter[, limit[, compare]]])

The Split function syntax has these named arguments:

Part Description
expression Required. String expression containing substrings and delimiters. If expression is a zero-length string(""), Split returns an empty array, that is, an array with no elements and no data.
delimiter Optional. String character used to identify substring limits. If omitted, the space character (" ") is assumed to be the delimiter. If delimiter is a zero-length string, a single-element array containing the entire expression string is returned.
limit Optional. Number of substrings to be returned; –1 indicates that all substrings are returned.
compare Optional. Numeric value indicating the kind of comparison to use when evaluating substrings. See Settings section for values.


Settings

The compare argument can have the following values:

Constant Value Description
vbUseCompareOption –1 Performs a comparison using the setting of the Option Compare statement.
vbBinaryCompare 0 Performs a binary comparison.
vbTextCompare 1 Performs a textual comparison.
vbDatabaseCompare 2 Microsoft Access only. Performs a comparison based on information in your database.
fraser01 2001-12-05
  • 打赏
  • 举报
回复
s="a,b,c,d"
h=split(s,",")
得到:
h(0)=a
h(1)=b
h(2)=c
h(3)=d

7,785

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧