473,387 Members | 3,684 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Turn a String Into An Array of Characters

Is there a function in VBA to convert a string to an array of characters. I'm
looking for the exact same functionality as the ToCharArray() method in C#.
If this functionality does not exist, do y'all have any pre-written code to
do this?

Psuedo-Hopeless Request-
Dear Microsoft: It would be cool if VBA had more robust string manipulation
functions like those in C#, which kick a*s.

TIA
Johnny
Nov 12 '05 #1
5 3441
me**************@msn.com (Johnny Meredith) wrote in
news:70**************************@posting.google.c om:
Is there a function in VBA to convert a string to an array of
characters. I'm looking for the exact same functionality as the
ToCharArray() method in C#. If this functionality does not exist, do
y'all have any pre-written code to do this?

Psuedo-Hopeless Request-
Dear Microsoft: It would be cool if VBA had more robust string
manipulation functions like those in C#, which kick a*s.


I guess you could just write all the functions you want in C++, compile them
into a DLL, and reference the DLL from Access. Sounds like a piece of cake to
me, as these string manipulation functions in C++ kick a*s!

Why not do that and then share it with your buddies here at CDMA, Johnny!?

Oh Yeah ... Access-VBA has this "Help" file. Try looking in there. You could
find something like Split ... not really, you could!

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #2
rkc

"Johnny Meredith" <me**************@msn.com> wrote in message
news:70**************************@posting.google.c om...
Is there a function in VBA to convert a string to an array of characters. I'm looking for the exact same functionality as the ToCharArray() method in C#. If this functionality does not exist, do y'all have any pre-written code to do this?


Why? What do you want to do with the array once you have it?
There's the Mid$ function that allows access to each individual character.
Look under the help topic example for StrConv for another possible solution.

Nov 12 '05 #3
Just to expand on what rkc said, note that the Mid function can actually be
used on the left hand side of the = assignment, so it truly does give you all
the capabilities of an array of characters, both for reasing and for
assignment.

Of course, that's still nothing like what C# or Java have, but I don't think
it would be a good idea to add that kind of string to VB/VBA since it's so
very different from what we've all learned to expect from those languages. of
course, you could write your own String and Stringbuffer classes if you want
to. Someone might even have done it already and has it somewhere for
download.

On 2 Apr 2004 08:54:46 -0800, me**************@msn.com (Johnny Meredith)
wrote:
Is there a function in VBA to convert a string to an array of characters. I'm
looking for the exact same functionality as the ToCharArray() method in C#.
If this functionality does not exist, do y'all have any pre-written code to
do this?

Psuedo-Hopeless Request-
Dear Microsoft: It would be cool if VBA had more robust string manipulation
functions like those in C#, which kick a*s.

TIA
Johnny


Nov 12 '05 #4
On Apr 02 2004, 11:54 am, me**************@msn.com (Johnny Meredith)
wrote in news:70**************************@posting.google.c om:
Is there a function in VBA to convert a string to an array of
characters. I'm looking for the exact same functionality as the
ToCharArray() method in C#.


I'm not sure what ToCharArray() does, but perhaps you can use something
like this:

Dim str as String
Dim ArrayOfBytes() As Byte

str = "ToCharArray"
ArrayOfBytes() = str

Keep in mind that strings in VBA are Unicode.

--
remove a 9 to reply by email
Nov 12 '05 #5
"rkc" <rk*@yabba.dabba.do.rochester.rr.bomb> wrote in
news:Ya*****************@twister.nyroc.rr.com:
"Johnny Meredith" <me**************@msn.com> wrote in message
news:70**************************@posting.google.c om...
Is there a function in VBA to convert a string to an array of
characters.

I'm
looking for the exact same functionality as the ToCharArray()
method in

C#.
If this functionality does not exist, do y'all have any
pre-written code

to
do this?


Why? What do you want to do with the array once you have it?
There's the Mid$ function that allows access to each individual
character. Look under the help topic example for StrConv for
another possible solution.


"Why?" is certainly the right question.

Any post that begins "how can I do in Access this thing I do in
language X?" is probably going to be a question based on a
misapprehension of the best way to get the task done in Access based
on knowledge from a domain that no longer applies.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 12 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Johnny Meredith | last post by:
Is there a function in VBA to convert a string to an array of characters. I'm looking for the exact same functionality as the ToCharArray() method in C#. If this functionality does not exist, do...
7
by: herrcho | last post by:
i'm in the course of learning C, and found these two words "string, string literal" confusing me.. I'd like to know the difference between them.. Thank you
14
by: Charles L | last post by:
I don't know if this is a stupid quesiton or not. I would like to know how to convert an array of characters generated from a previous operation to a string ie how do I append a null character at...
51
by: Alan | last post by:
hi all, I want to define a constant length string, say 4 then in a function at some time, I want to set the string to a constant value, say a below is my code but it fails what is the correct...
17
by: Chad Myers | last post by:
I've been perf testing an application of mine and I've noticed that there are a lot (and I mean A LOT -- megabytes and megabytes of 'em) System.String instances being created. I've done some...
18
by: Ger | last post by:
I have not been able to find a simple, straight forward Unicode to ASCII string conversion function in VB.Net. Is that because such a function does not exists or do I overlook it? I found...
26
by: alberto | last post by:
Hi. Im newbie in C language. I have a binary file with many character arrays of 50 character defined as char array But in some cases, many of these 50 characters are not being used. I would...
18
by: John | last post by:
Hi, I'm a beginner is using C# and .net. I have big legacy files that stores various values (ints, bytes, strings) and want to read them into a C# programme so that I can store them in a...
2
by: Paul Hobbs | last post by:
Hi, I wanted to create a function which forced a user to enter no more than a specified number of characters. The code for this is below. The idea was simple, if a user is only meant to enter 10...
14
by: Shhnwz.a | last post by:
Hi, I am in confusion regarding jargons. When it is technically correct to say.. String or Character Array.in c. just give me your perspectives in this issue. Thanx in Advance.
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.