473,236 Members | 1,668 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,236 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 27965
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

3
by: Goh, Yong Kwang | last post by:
I'm trying to create a function that given a string, tokenize it and put into a dynamically-sized array of char* which is in turn also dynamically allocated based on the string token length. I...
4
by: Garfield | last post by:
Hello I have a function that returns a string array. The string has a name and an ID number, they are separated by a comma. I cannot for the life of me by using the string methods get to...
4
by: diDE | last post by:
I want to convert a managed string array f.e. array<string^>^ Texts; // Elements 0: "ABC", 1: "HJO" to a TCHAR** or wchar_t** any ideas?
6
by: Bruce Wiebe | last post by:
Hi all I have a string that contains a list of email addresses in the format {"X@y.com","x@y.com"} and i need to convert it to a string array in the same format so my array would loook like ...
5
by: Paulers | last post by:
Hello all, I have a string array with duplicate elements. I need to create a new string array containing only the unique elements. Is there an easy way to do this? I have tried looping through...
6
by: Niyazi | last post by:
Hi all, What is fastest way removing duplicated value from string array using vb.net? Here is what currently I am doing but the the array contains over 16000 items. And it just do it in 10 or...
10
by: Visual Systems AB \(Martin Arvidsson\) | last post by:
Hi! Got a simple question. I am new to c# but this is not making me any sence. If i declare: string myStringArray = new string; How the heck could i fill it with more than one element? ...
8
by: Pim75 | last post by:
Hello, I'm defining a string array like: Dim strArray() As String = {"1", "2"} Can I add some values to this string array later in the code? It's not clear to me how to do this. I hope...
2
by: LinLMa | last post by:
Hello everyone, I find strange result in the following program. 1. For string array, dereferencing it will result in the string itself, but for int array, dereferencing it will result in the...
1
Osoascam
by: Osoascam | last post by:
Hi! I was looking for some help on this matter and found this: http://bytes.com/forum/thread643133.html which... I didn't 100% got. So... I'll try to explain what I need: array = "First string"...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.