is there any way that i could convert a character from a string to an integer in an array?
like,
String a = "1110";
and convert it to:
int b[] = {1,1,1,0};
7 3037
is there any way that i could convert a character from a string to an integer in an array?
like,
String a = "1110";
and convert it to:
int b[] = {1,1,1,0};
What have you tried so far? I can think of several ways to do it.
is there any way that i could convert a character from a string to an integer in an array?
like,
String a = "1110";
and convert it to:
int b[] = {1,1,1,0};
You might want to have a look at the Character, the String and the Integer API entries.
Greetings,
Nepomuk
You might want to have a look at the Character, the String and the Integer API entries.
Greetings,
Nepomuk
I was beginning to think the terrorists had kidnapped you again.
I was beginning to think the terrorists had kidnapped you again.
Na, just didn't have much time for programming in the last few months and therefore never checked what was going on here... But now I have a new little project and when I wanted to check something up, guess where I went? ^^
Greetings,
Nepomuk
How about this ...
String s = "" + 1110;
int[] b = new int[4];
for(int i=0; i<s.length();i++) {
int d =Integer.parseInt(""+ s.charAt(i));
b[i]=d;
}
How about this ...
Now, that's most certainly spoon feeding. By the way, that will work for the number 1110, but it's not really a generic answer and as I don't think, the program will only ever be confronted with 1110, it's not much use.
Greetings,
Nepomuk
I showed this as an example. If i put this is a function which accepts an int and use that paramter in place of 1100 it will be generic.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Markus Hämmerli |
last post by:
I ' ll tra to convert a Cstring to char* without success.
I working in a Unicode enabled environment
this is working in Unicode
CString source = _T("TestString");
TCHAR *szSource =...
|
by: Sam Smith |
last post by:
Hi,
I wan't a function to take a const char*, a start bit position and number of
bits and convert that bit-stream into a primitive of desired type.
I.e. something like:
char convert(const...
|
by: Brad Moore |
last post by:
Hey all,
I'm getting the following compiler error from my code. I was wondering
if anyone could help me understand the concept behind it (I actually did
try and compile this degenerate...
|
by: whatluo |
last post by:
Hi, all
I'm now working on a program which will convert dec number to
hex and oct and bin respectively, I've checked the clc but with no
luck, so can anybody give me a hit how to make this done...
|
by: MilanB |
last post by:
Hello
How to convert char to int?
Thanks
|
by: Yifan |
last post by:
Hi
Does anybody know how to convert System::String* to char*? I searched the System::String class members and did not find any. Thanks
Yifan
|
by: caramel |
last post by:
i've been working on this program forever! now i'm stuck and going
insane because i keep getting a syntax error msg and i just can't see
what the compiler is signaling to!
#include <stdio.h>...
|
by: Eric BOUXIROT |
last post by:
hi,
i must convert all of these eVC++ prototypes to use with VB.NET....
DLLEXPORT long F_BDO_MessageBoxOK(char *IN_title, char *IN_msg );
DLLEXPORT long F_BDO_MessageBoxOUINON(char *IN_title,...
|
by: GRoll35 |
last post by:
I get 4 of those errors. in the same spot. I'll show my parent class,
child class, and my driver.
All that is suppose to happen is the user enters data and it uses
parent/child class to display...
|
by: Zytan |
last post by:
I am surprised that a single character string is not auto-created from
a single char. It is hard to find information on converting a char
into a string, since most people ask how to convert char...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |