int total = 0; string str = "abcdefghijklmnopqrstuvwxyz"; foreach (char c in str.ToCharArray()) { total += (int)c; }
Assert.AreEqual(42, total); Davy, "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - Martin Golding "After a bit of digging, it was pretty clear that the 'issues' were in the data access class. It was named 'summoner.cs'" DailyWTF On Mon, Oct 10, 2011 at 3:37 PM, Tom Gao <t...@tomgao.com> wrote: > Hi All,**** > > ** ** > > Does anyone know how to convert a string of ASCII characters to int? **** > > Eg**** > > “abcd” to some form of int.**** > > ** ** > > I need to do a bunch of calculations on strings the only way is if they’re > in int not sure if anyone know of a good way to do this.**** > > ** ** > > Thanks,**** > > Tom**** >