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

x
?
Solved

Simple way to convert integer to an array?

Posted on 2012-08-15
3
Medium Priority
?
293 Views
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
0
Comment
Question by:Tom Knowlton
3 Comments
 
LVL 4

Assisted Solution

by:DustinKikuchi
DustinKikuchi earned 1000 total points
ID: 38297775
0
 
LVL 13

Accepted Solution

by:
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.
0
 
LVL 5

Author Closing Comment

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

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