Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Simple way to convert integer to an array?

Posted on 2012-08-15
Medium Priority
Last Modified: 2012-08-15
Please provide code in C#.

Given string "2349847"

How do I convert that to an array of integers, such that:

a[0] = 2
a[1] = 3
a[2] = 4
a[3] = 9
a[4] = 8
a[5] = 4
a[6] = 7
Question by:Tom Knowlton

Assisted Solution

DustinKikuchi earned 1000 total points
ID: 38297775
LVL 13

Accepted Solution

LIONKING earned 1000 total points
ID: 38297789
I don't know if there's a specific function for that, but if not you can always create the array and loop through every position of the string (with a for or while loop). Inside your loop you will capture one character (with myString.SubString) and assign it to the array.

Dirty, but if you don't find a function that does that in one shot I guess it could work.

Author Closing Comment

by:Tom Knowlton
ID: 38297797
Thanks...this got me going in the right direction!

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month14 days, 2 hours left to enroll

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question