List Info

Thread: String to integer Array




String to integer Array
user name
2006-05-30 03:08:51
I was interested in performant as I now have comparative
figures if
speed becomes an issue greatly appreciated.

-----Original Message-----
From: Discussion of development on the .NET platform using
any managed
language [mailtoOTNET-CL
RDISCUSS.DEVELOP.COM] On Behalf Of gregory
young
Sent: Tuesday, 30 May 2006 1:08 PM
To: DOTNET-CLRDISCUSS.DEVELOP.COM
Subject: Re: [DOTNET-CLR] String to integer Array

perhaps I misunderstood you .. I thought you asked for the
most
performant
way of doing this ..

split: 00:00:04.3906250
iterate: 00:00:00.5000000
delegate: 00:00:04.9843750
unsafe: 00:00:00.3750000

Oh well, its an interesting blog post.

Cheers,

Greg Young

On 5/29/06, Robert Rolls <Robert.Rollsdevnet.ato.gov.au> wrote:
>
> Thanks I made the intToString an anonymous delegate
works like a dream
> thanks.
>
> -----Original Message-----
> From: Discussion of development on the .NET platform
using any managed
> language [mailtoOTNET-CL
RDISCUSS.DEVELOP.COM] On Behalf Of Ernst
> Kuschke
> Sent: Tuesday, 30 May 2006 12:22 PM
> To: DOTNET-CLRDISCUSS.DEVELOP.COM
> Subject: Re: [DOTNET-CLR] String to integer Array
>
> public static int[] doTheThing(string
commadelimitedInts)
> {
>    return Array.ConvertAll<string,
int>(commadelimitedInts.Split(new
> string[]
> { "," },
StringSplitOptions.RemoveEmptyEntries), new
> Converter<string,int
> >(intToString));
> }
>
> public static int intToString(string strInt)
> {
>    int i;
>    int.TryParse(strInt, out i);
>    return i;
> }
>
> HTH!!!
>
> --
> Ernst Kuschke
> MVP - C#
> http://dotnet.org.za/ernst

>
> On 5/30/06, Robert Rolls <Robert.Rollsdevnet.ato.gov.au> wrote:
> >
> > I have a comma separated list of integer values
what's the quickest
> way
> > to turn this into a integer array.
> >
> >
> >
> > Rob.
> >
> >
> >
> > 'Technical Architecture don't dwell on problems,
we focus solely on
> > providing solutions.'
> >
> >
> >
> >
> > ===================================
> > This list is hosted by DevelopMentor(r)  http://www.develop.com
> >
> > View archives and manage your subscription(s) at
> > http://discuss.develop.com

> >
>
> ===================================
> This list is hosted by DevelopMentor(r)  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com

>
> ===================================
> This list is hosted by DevelopMentor(r)  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com

>



--
If knowledge can create problems, it is not through
ignorance that we
can
solve them.

Isaac Asimov

===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com


===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

String to integer Array
user name
2006-05-30 04:59:17
Blogged if you need further info (also included using a
generic as a return
to remove the nastiness with buffers) :
http://geekswithblogs.net/gyoung/archive/2006/05/2
9/80056.aspx

Cheers,

Greg


On 5/29/06, Robert Rolls <Robert.Rollsdevnet.ato.gov.au> wrote:
>
> I was interested in performant as I now have
comparative figures if
> speed becomes an issue greatly appreciated.
>
> -----Original Message-----
> From: Discussion of development on the .NET platform
using any managed
> language [mailtoOTNET-CL
RDISCUSS.DEVELOP.COM] On Behalf Of gregory
> young
> Sent: Tuesday, 30 May 2006 1:08 PM
> To: DOTNET-CLRDISCUSS.DEVELOP.COM
> Subject: Re: [DOTNET-CLR] String to integer Array
>
> perhaps I misunderstood you .. I thought you asked for
the most
> performant
> way of doing this ..
>
> split: 00:00:04.3906250
> iterate: 00:00:00.5000000
> delegate: 00:00:04.9843750
> unsafe: 00:00:00.3750000
>
> Oh well, its an interesting blog post.
>
> Cheers,
>
> Greg Young
>
> On 5/29/06, Robert Rolls <Robert.Rollsdevnet.ato.gov.au> wrote:
> >
> > Thanks I made the intToString an anonymous
delegate works like a dream
> > thanks.
> >
> > -----Original Message-----
> > From: Discussion of development on the .NET
platform using any managed
> > language [mailtoOTNET-CL
RDISCUSS.DEVELOP.COM] On Behalf Of Ernst
> > Kuschke
> > Sent: Tuesday, 30 May 2006 12:22 PM
> > To: DOTNET-CLRDISCUSS.DEVELOP.COM
> > Subject: Re: [DOTNET-CLR] String to integer Array
> >
> > public static int[] doTheThing(string
commadelimitedInts)
> > {
> >    return Array.ConvertAll<string,
int>(commadelimitedInts.Split(new
> > string[]
> > { "," },
StringSplitOptions.RemoveEmptyEntries), new
> > Converter<string,int
> > >(intToString));
> > }
> >
> > public static int intToString(string strInt)
> > {
> >    int i;
> >    int.TryParse(strInt, out i);
> >    return i;
> > }
> >
> > HTH!!!
> >
> > --
> > Ernst Kuschke
> > MVP - C#
> > http://dotnet.org.za/ernst

> >
> > On 5/30/06, Robert Rolls <Robert.Rollsdevnet.ato.gov.au> wrote:
> > >
> > > I have a comma separated list of integer
values what's the quickest
> > way
> > > to turn this into a integer array.
> > >
> > >
> > >
> > > Rob.
> > >
> > >
> > >
> > > 'Technical Architecture don't dwell on
problems, we focus solely on
> > > providing solutions.'
> > >
> > >
> > >
> > >
> > > ===================================
> > > This list is hosted by DevelopMentor(r)  http://www.develop.com
> > >
> > > View archives and manage your subscription(s)
at
> > > http://discuss.develop.com

> > >
> >
> > ===================================
> > This list is hosted by DevelopMentor(r)  http://www.develop.com
> >
> > View archives and manage your subscription(s) at
> > http://discuss.develop.com

> >
> > ===================================
> > This list is hosted by DevelopMentor(r)  http://www.develop.com
> >
> > View archives and manage your subscription(s) at
> > http://discuss.develop.com

> >
>
>
>
> --
> If knowledge can create problems, it is not through
ignorance that we
> can
> solve them.
>
> Isaac Asimov
>
> ===================================
> This list is hosted by DevelopMentor(r)  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com

>
> ===================================
> This list is hosted by DevelopMentor(r)  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com

>



--
If knowledge can create problems, it is not through
ignorance that we can
solve them.

Isaac Asimov

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

String to integer Array
user name
2006-05-31 18:26:36
Cool!
Instead of delegating to an inline method, you can delegate
to an existing
framework method ;o)

int i[] = Array.ConvertAll<string,
int>(commadelimitedInts.Split(new string[]
{ "," }, StringSplitOptions.RemoveEmptyEntries),
new Converter<string, int
>(System.Convert.ToInt32));

http://dotnet.org.za/ernst/archive/2006/05/31/52868.aspx



On 5/30/06, Robert Rolls <Robert.Rollsdevnet.ato.gov.au> wrote:
>
> I was interested in performant as I now have
comparative figures if
> speed becomes an issue greatly appreciated.
>
> -----Original Message-----
> From: Discussion of development on the .NET platform
using any managed
> language [mailtoOTNET-CL
RDISCUSS.DEVELOP.COM] On Behalf Of gregory
> young
> Sent: Tuesday, 30 May 2006 1:08 PM
> To: DOTNET-CLRDISCUSS.DEVELOP.COM
> Subject: Re: [DOTNET-CLR] String to integer Array
>
> perhaps I misunderstood you .. I thought you asked for
the most
> performant
> way of doing this ..
>
> split: 00:00:04.3906250
> iterate: 00:00:00.5000000
> delegate: 00:00:04.9843750
> unsafe: 00:00:00.3750000
>
> Oh well, its an interesting blog post.
>
> Cheers,
>
> Greg Young
>
> On 5/29/06, Robert Rolls <Robert.Rollsdevnet.ato.gov.au> wrote:
> >
> > Thanks I made the intToString an anonymous
delegate works like a dream
> > thanks.
> >
> > -----Original Message-----
> > From: Discussion of development on the .NET
platform using any managed
> > language [mailtoOTNET-CL
RDISCUSS.DEVELOP.COM] On Behalf Of Ernst
> > Kuschke
> > Sent: Tuesday, 30 May 2006 12:22 PM
> > To: DOTNET-CLRDISCUSS.DEVELOP.COM
> > Subject: Re: [DOTNET-CLR] String to integer Array
> >
> > public static int[] doTheThing(string
commadelimitedInts)
> > {
> >    return Array.ConvertAll<string,
int>(commadelimitedInts.Split(new
> > string[]
> > { "," },
StringSplitOptions.RemoveEmptyEntries), new
> > Converter<string,int
> > >(intToString));
> > }
> >
> > public static int intToString(string strInt)
> > {
> >    int i;
> >    int.TryParse(strInt, out i);
> >    return i;
> > }
> >
> > HTH!!!
> >
> > --
> > Ernst Kuschke
> > MVP - C#
> > http://dotnet.org.za/ernst

> >
> > On 5/30/06, Robert Rolls <Robert.Rollsdevnet.ato.gov.au> wrote:
> > >
> > > I have a comma separated list of integer
values what's the quickest
> > way
> > > to turn this into a integer array.
> > >
> > >
> > >
> > > Rob.
> > >
> > >
> > >
> > > 'Technical Architecture don't dwell on
problems, we focus solely on
> > > providing solutions.'
> > >
> > >
> > >
> > >
> > > ===================================
> > > This list is hosted by DevelopMentor(r)  http://www.develop.com
> > >
> > > View archives and manage your subscription(s)
at
> > > http://discuss.develop.com

> > >
> >
> > ===================================
> > This list is hosted by DevelopMentor(r)  http://www.develop.com
> >
> > View archives and manage your subscription(s) at
> > http://discuss.develop.com

> >
> > ===================================
> > This list is hosted by DevelopMentor(r)  http://www.develop.com
> >
> > View archives and manage your subscription(s) at
> > http://discuss.develop.com

> >
>
>
>
> --
> If knowledge can create problems, it is not through
ignorance that we
> can
> solve them.
>
> Isaac Asimov
>
> ===================================
> This list is hosted by DevelopMentor(r)  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com

>
> ===================================
> This list is hosted by DevelopMentor(r)  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com

>



--
Ernst Kuschke
MVP - C#
http://dotnet.org.za/ernst


===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

String to integer Array
user name
2006-06-07 00:43:04
Array.ForEach<T>(T[], Action<T>) is even more
fun ! 



---
Vince

> -----Original Message-----
> From: Discussion of development on the .NET platform
using any managed
language
> [mailtoOTNET-CL
RDISCUSS.DEVELOP.COM] On Behalf Of Ernst Kuschke
> Sent: Wednesday, May 31, 2006 1:27 PM
> To: DOTNET-CLRDISCUSS.DEVELOP.COM
> Subject: Re: [DOTNET-CLR] String to integer Array
>
> Cool!
> Instead of delegating to an inline method, you can
delegate to an existing
framework
> method ;o)
>
> int i[] = Array.ConvertAll<string,
int>(commadelimitedInts.Split(new
string[] { "," },
> StringSplitOptions.RemoveEmptyEntries), new
Converter<string, int
> >(System.Convert.ToInt32));
>
> http://dotnet.org.za/ernst/archive/2006/05/31/52868.aspx

>
>
> On 5/30/06, Robert Rolls <Robert.Rollsdevnet.ato.gov.au> wrote:
> >
> > I was interested in performant as I now have
comparative figures if
> > speed becomes an issue greatly appreciated.
> >
> > -----Original Message-----
> > From: Discussion of development on the .NET
platform using any managed
> > language [mailtoOTNET-CL
RDISCUSS.DEVELOP.COM] On Behalf Of gregory
> > young
> > Sent: Tuesday, 30 May 2006 1:08 PM
> > To: DOTNET-CLRDISCUSS.DEVELOP.COM
> > Subject: Re: [DOTNET-CLR] String to integer Array
> >
> > perhaps I misunderstood you .. I thought you asked
for the most
> > performant way of doing this ..
> >
> > split: 00:00:04.3906250
> > iterate: 00:00:00.5000000
> > delegate: 00:00:04.9843750
> > unsafe: 00:00:00.3750000
> >
> > Oh well, its an interesting blog post.
> >
> > Cheers,
> >
> > Greg Young
> >
> > On 5/29/06, Robert Rolls <Robert.Rollsdevnet.ato.gov.au> wrote:
> > >
> > > Thanks I made the intToString an anonymous
delegate works like a
> > > dream thanks.
> > >
> > > -----Original Message-----
> > > From: Discussion of development on the .NET
platform using any
> > > managed language [mailtoOTNET-CL
RDISCUSS.DEVELOP.COM] On Behalf
> > > Of Ernst Kuschke
> > > Sent: Tuesday, 30 May 2006 12:22 PM
> > > To: DOTNET-CLRDISCUSS.DEVELOP.COM
> > > Subject: Re: [DOTNET-CLR] String to integer
Array
> > >
> > > public static int[] doTheThing(string
commadelimitedInts) {
> > >    return Array.ConvertAll<string,
int>(commadelimitedInts.Split(new
> > > string[] { "," },
StringSplitOptions.RemoveEmptyEntries), new
> > > Converter<string,int
> > > >(intToString));
> > > }
> > >
> > > public static int intToString(string strInt)
> > > {
> > >    int i;
> > >    int.TryParse(strInt, out i);
> > >    return i;
> > > }
> > >
> > > HTH!!!
> > >
> > > --
> > > Ernst Kuschke
> > > MVP - C#
> > > http://dotnet.org.za/ernst

> > >
> > > On 5/30/06, Robert Rolls <Robert.Rollsdevnet.ato.gov.au> wrote:
> > > >
> > > > I have a comma separated list of integer
values what's the quickest
> > > way
> > > > to turn this into a integer array.
> > > >
> > > >
> > > >
> > > > Rob.
> > > >
> > > >
> > > >
> > > > 'Technical Architecture don't dwell on
problems, we focus solely on
> > > > providing solutions.'
> > > >
> > > >
> > > >
> > > >
> > > > ===================================
> > > > This list is hosted by DevelopMentor(r) 
http://www.develop.com
> > > >
> > > > View archives and manage your
subscription(s) at
> > > > http://discuss.develop.com

> > > >
> > >
> > > ===================================
> > > This list is hosted by DevelopMentor(r)  http://www.develop.com
> > >
> > > View archives and manage your subscription(s)
at
> > > http://discuss.develop.com

> > >
> > > ===================================
> > > This list is hosted by DevelopMentor(r)  http://www.develop.com
> > >
> > > View archives and manage your subscription(s)
at
> > > http://discuss.develop.com

> > >
> >
> >
> >
> > --
> > If knowledge can create problems, it is not
through ignorance that we
> > can
> > solve them.
> >
> > Isaac Asimov
> >
> > ===================================
> > This list is hosted by DevelopMentor(r)  http://www.develop.com
> >
> > View archives and manage your subscription(s) at
> > http://discuss.develop.com

> >
> > ===================================
> > This list is hosted by DevelopMentor(r)  http://www.develop.com
> >
> > View archives and manage your subscription(s) at
> > http://discuss.develop.com

> >
>
>
>
> --
> Ernst Kuschke
> MVP - C#
> http://dotnet.org.za/ernst

>
> ===================================
> This list is hosted by DevelopMentorR  http://www.develop.com
>
> View archives and manage your subscription(s) at
http://discuss.develop.com


===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )