473,320 Members | 1,887 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,320 software developers and data experts.

String to string Array

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

dim emailaddresses() as string={"X@y.com","x@y.com"}

Does anyone know an easy way to do this

Thanks in advance

Nov 20 '05 #1
6 1765
You could use the Split method of the String class:
dim emailaddresses() as string = xxx.Split(",")

If your xxx string looks like {"X@y.com","x@y.com"}, so it contains { and "
characters, you need to strip them off.
--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan
"Bruce Wiebe" <Br***@wolfnetwork.net> wrote in message
news:bu**********@sparta.btinternet.com...
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

dim emailaddresses() as string={"X@y.com","x@y.com"}

Does anyone know an easy way to do this

Thanks in advance

Nov 20 '05 #2
Cor
Hi Bruce,

Have a look of the different versions of "Split"

I hope this helps?

Cor
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
dim emailaddresses() as string={"X@y.com","x@y.com"}
Does anyone know an easy way to do this

Nov 20 '05 #3
Try the "String.Split" method.

e.g.

-------------------------

Dim szSource as String = "X@y.com,z@y.com"
Dim aEmails as String() = szSource.Split(","c)

-------------------------

The above example uses a comma (,) as the delimiter between the email
addresses.

HTH,

Trev.

"Bruce Wiebe" <Br***@wolfnetwork.net> wrote in message
news:bu**********@sparta.btinternet.com...
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

dim emailaddresses() as string={"X@y.com","x@y.com"}

Does anyone know an easy way to do this

Thanks in advance

Nov 20 '05 #4
"Bruce Wiebe" <Br***@wolfnetwork.net> schrieb

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

dim emailaddresses() as string={"X@y.com","x@y.com"}

Does anyone know an easy way to do this


dim s as string()

s = yourstring.split(","c)
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #5
* "Cor" <no*@non.com> scripsit:
Have a look of the different versions of "Split"


Very important note!

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #6
Bruce,
As the other have pointed out have you looked at one of the 3 split methods?

Its unclear from your post, does the input string literally contain quotes &
curly braces? You may need to do a little more work. In addition to
RegEx.Split you can use one of the email patterns & RegEx.Matches to find
all the email addresses in a string, which for your string may be the easier
method. A variation of the following topics:

http://msdn.microsoft.com/library/de...nformation.asp

http://msdn.microsoft.com/library/de...nformation.asp
There are three Split functions in .NET:

Use Microsoft.VisualBasic.Strings.Split if you need to split a string based
on a specific word (string). It is the Split function from VB6.

Use System.String.Split if you need to split a string based on a collection
of specific characters. Each individual character is its own delimiter.

Use System.Text.RegularExpressions.RegEx.Split to split based
on matching patterns.

Hope this helps
Jay
"Bruce Wiebe" <Br***@wolfnetwork.net> wrote in message
news:bu**********@sparta.btinternet.com...
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

dim emailaddresses() as string={"X@y.com","x@y.com"}

Does anyone know an easy way to do this

Thanks in advance

Nov 20 '05 #7

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

Similar topics

16
by: Don Starr | last post by:
When applied to a string literal, is the sizeof operator supposed to return the size of the string (including nul), or the size of a pointer? For example, assuming a char is 1 byte and a char *...
7
by: al | last post by:
char s = "This string literal"; or char *s= "This string literal"; Both define a string literal. Both suppose to be read-only and not to be modified according to Standard. And both have...
4
by: songkv | last post by:
Hi, I am trying to reassign an array of char to a string literal by calling a function. In the function I use pointer-to-pointer since I want to reassign the "string array pointer" to the string...
22
by: spike | last post by:
How do i reset a string? I just want to empty it som that it does not contain any characters Say it contains "hello world" at the time... I want it to contain "". Nothing that is.. Thanx
4
by: Simon Schaap | last post by:
Hello, I have encountered a strange problem and I hope you can help me to understand it. What I want to do is to pass an array of chars to a function that will split it up (on every location where...
14
by: Bob | last post by:
I have a function that takes in a list of IDs (hundreds) as input parameter and needs to pass the data to another step as a comma delimited string. The source can easily create this list of IDs in...
8
by: Jeff Johnson | last post by:
Hi, I've begun converting an ASP site over to .NET and I'm a novice at both the new platform as well as C#. I have a COM+ object that returns a string array when it is called. The size of...
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...
11
by: Zordiac | last post by:
How do I dynamically populate a string array? I hope there is something obvious that I'm missing here Option Strict On dim s() as string dim sTmp as string = "test" dim i as integer ...
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.