473,396 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how do I interprate a sting of 1 or 0 in a clever way

Hello!

I have 10 string fields which are elements or gas or someting else and some
symbol behind if less then or greater then se below. In the database there
is a string telling which field should be used by setting 1 or 0 in the
actual position. So for example field in position 5 is field Si<.
If only this field Si< should be used then the string in the database has
this look 00000100000
If all fields should be used then the string in the database look like
11111111011.
As you can see position 8 is not used and is always 0.

Now to my question is it anybody that have some clever algoritm to load an
array with the elements that
has setting 1.

index
0. C<
1. N<
2. N>
3. T<
4. T>
5. Si<
6. O2>
7. N2>
8.
9. Ar>
10. Time

Many thanks

//Tony
Apr 11 '06 #1
1 1171
Im sure you are cappable of doing this on your own if you work at it.
To my experince new programmers lack more in confidence than skills.

big hint...

string flags = "110011001";
for(int n = 0; n<flags.Lenght; n++)
if(flags[n] == '1')
{
//add to array
}

Apr 11 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Gilles Lenfant | last post by:
Hi, I make an app where I need to convert HTML to text in a "clever" way (means it tries to mimic when possible a browser rendering). Actually I spawn with popen2 a "lynx" that makes a perfect...
2
by: Philip White | last post by:
Unfortunately I can't use the excuse of being a SQL newbie, but drawn a blank on the following "simple" problem. I have a table containing the following (extract) : ...
3
by: Paul | last post by:
Hello, Does anyone has a suggestion where (website) to find a very good collection of cool/useful/clever examples of form usage/programming? Things I try to do, are not available in...
4
by: Mark P | last post by:
I have a header file and want to expose only a limited portion of that file to SWIG (all you need to know is that when SWIG processes a file the preprocessor macro SWIG is defined). Otherwise I...
12
by: Jack Daly | last post by:
I've inherited some code which uses an undocumented feature of a third-party vendor's library. Essentially, this vendor has kept the details of an interface struct secret, but we can pass a pointer...
18
by: ballpointpenthief | last post by:
I was messing around with an exercise I found. This seems to work, except in debugging, some VERY odd stuff happens, so I thought I'd chuck the code on here to see how it stands up. I had to...
4
by: Sjaakie | last post by:
I need to replace parts of a string, in a collection deserialized from an XML file, with values from another collection. Is there another, more clever/faster/better, method than the loops below? ...
1
by: mishibala | last post by:
i have a string value str=" o'clok " i want to write it to my data base (sql server 2000). but i get an error.. because data base thinks that the sign ' in the o'clock is data base sign...how can i...
5
by: Gregory Piñero | last post by:
How do I put % in a format sting? For example I want this to work: Traceback (most recent call last): File "<interactive input>", line 1, in ? TypeError: not enough arguments for format string
0
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...
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
marktang
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.