473,327 Members | 2,065 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,327 software developers and data experts.

how to convert data from string to nibble

i need to convert data from string to nibble wich (nibble is a four bits
representation)

As example i have the following code

string data1 = "12345678";

so ¿how can i convert this data (numbers) to a nibble representation?

thanks for any idea
Jul 13 '07 #1
8 6563
Hi,
"Ricardo Quintanilla" <Ri****************@discussions.microsoft.comwro te
in message news:9A**********************************@microsof t.com...
>i need to convert data from string to nibble wich (nibble is a four bits
representation)

As example i have the following code

string data1 = "12345678";

so ¿how can i convert this data (numbers) to a nibble representation?
how do y ou want to keep the nibble? do u have a class for that?

You can convert it to int and extract the nibble of each digit
Jul 13 '07 #2
On Fri, 13 Jul 2007 06:52:01 -0700, Ricardo Quintanilla
<Ri****************@discussions.microsoft.comwrote :
i need to convert data from string to nibble wich (nibble is a four bits
representation)

As example i have the following code

string data1 = "12345678";

so ¿how can i convert this data (numbers) to a nibble representation?
Your question is too vague to be answered.

First, the question is when you write "this data (numbers)", what exactly
is the data you want to convert _from_? Do the numbers represent an
actual integer value that you then want to extract the nibbles from? Do
you want the nibbles straight from the Unicode string that represents the
numbers? Do you want some other kind of string instead (e.g. ASCII)?

While you are thinking about those questions, you might review things like
the System.Text.Encoding class and its descendants, the Parse() method for
various numeric types, and the BitConverter class. Some or all of those
might be useful in solving your problem, depending on what your actual
goal is.

Pete
Jul 13 '07 #3

i just have to pass the result (the nibble) as string parameter to external
method in a external class.

could you please give an advice?

"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,
"Ricardo Quintanilla" <Ri****************@discussions.microsoft.comwro te
in message news:9A**********************************@microsof t.com...
i need to convert data from string to nibble wich (nibble is a four bits
representation)

As example i have the following code

string data1 = "12345678";

so ¿how can i convert this data (numbers) to a nibble representation?

how do y ou want to keep the nibble? do u have a class for that?

You can convert it to int and extract the nibble of each digit
Jul 13 '07 #4
On Fri, 13 Jul 2007 07:18:01 -0700, Ricardo Quintanilla
<Ri****************@discussions.microsoft.comwrote :
i just have to pass the result (the nibble) as string parameter to
external
method in a external class.
A nibble isn't a string. It's 4 bits of data. So you have another
ambiguity in your question: you obviously want to convert the nibble back
to a string, so how exactly do you want to represent the nibble as a
string? What format should it have?
Jul 13 '07 #5
Thanks for your answer.

The numers that i have used for the example, will represent in my real code
a "credit card numer".

I need to implement some sort of special codificaction for a Visa process of
validation. It is an integration beetwen a visa partner and a bank in i work
for.

the requeriment was simpley: take the credit card numer, transform to a
nibble representation and pass that value to a method X.

thanks again
"Peter Duniho" wrote:
On Fri, 13 Jul 2007 06:52:01 -0700, Ricardo Quintanilla
<Ri****************@discussions.microsoft.comwrote :
i need to convert data from string to nibble wich (nibble is a four bits
representation)

As example i have the following code

string data1 = "12345678";

so ¿how can i convert this data (numbers) to a nibble representation?

Your question is too vague to be answered.

First, the question is when you write "this data (numbers)", what exactly
is the data you want to convert _from_? Do the numbers represent an
actual integer value that you then want to extract the nibbles from? Do
you want the nibbles straight from the Unicode string that represents the
numbers? Do you want some other kind of string instead (e.g. ASCII)?

While you are thinking about those questions, you might review things like
the System.Text.Encoding class and its descendants, the Parse() method for
various numeric types, and the BitConverter class. Some or all of those
might be useful in solving your problem, depending on what your actual
goal is.

Pete
Jul 13 '07 #6
On Jul 13, 3:32 pm, Ricardo Quintanilla
<RicardoQuintani...@discussions.microsoft.comwrote :
Thanks for your answer.

The numers that i have used for the example, will represent in my real code
a "credit card numer".

I need to implement some sort of special codificaction for a Visa process of
validation. It is an integration beetwen a visa partner and a bank in i work
for.

the requeriment was simpley: take the credit card numer, transform to a
nibble representation and pass that value to a method X.
That requirement is still too vague - it doesn't explain what a nibble
representation really is, or how the credit card number should be
transformed.

Given that this is a finance requirement, it's likely that there are
very detailed requirements *somewhere* - but you'll need to find them
before you can make any more progress.

Jon

Jul 13 '07 #7
Hi,

"Ricardo Quintanilla" <Ri****************@discussions.microsoft.comwro te
in message news:50**********************************@microsof t.com...
>
i just have to pass the result (the nibble) as string parameter to
external
method in a external class.
I do not understand, what do you want to see in the string? the 8 bit
representation of the 4 bit nibble?
Jul 13 '07 #8
On Fri, 13 Jul 2007 07:32:06 -0700, Ricardo Quintanilla
<Ri****************@discussions.microsoft.comwrote :
[...]
the requeriment was simpley: take the credit card numer, transform to a
nibble representation and pass that value to a method X.
As Jon points out, that's not a more specific explanation of what you need
to do. If anything, it creates new ambiguities, because it raises the
possibility that you are not in fact trying to get a "nibble" at all.

But regardless, without some precise statement of what the input and
output should be, it's not possible to answer the question.

Pete
Jul 13 '07 #9

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

Similar topics

4
by: aevans1108 | last post by:
expanding this message to microsoft.public.dotnet.xml Greetings Please direct me to the right group if this is an inappropriate place to post this question. Thanks. I want to format a...
6
by: Ricardo Quintanilla | last post by:
i have a code that sends data to a socket listening over as400 platform, the socket responds to me as a "byte array". then i need to convert the "byte array" into a string. the problem is that...
7
by: Yama | last post by:
Hi, I have the following binary data: StringData = 800006000000; which is equivalent to the following: byte bytes = new byte; bytes = 0x80;
17
by: David Scemama | last post by:
Hi, I'm writing a program using VB.NET that needs to communicate with a DOS Pascal program than cannot be modified. The communication channel is through some file databases, and I have a huge...
5
by: manmit.walia | last post by:
Hello All, I am stuck on a conversion problem. I am trying to convert my application which is written in VB.NET to C# because the project I am working on currently is being written in C#. I tried...
5
by: Learner | last post by:
Hello, Here is the code snippet I got strucked at. I am unable to convert the below line of code to its equavalent vb.net code. could some one please help me with this? static public...
1
by: pnbaocuong | last post by:
Dear All When I try to use convert function of MS sql server like this: String sql = " (employee_id = '" + employee_id + "') and ((convert(VARCHAR,w_date,103) = '" + w_date + "'))"; ...
9
by: hari | last post by:
hi all, Im writing a code in which the bytes,needed to be splitted in to nibbles.each nibble needs to be made as byte. for example: consider 3B as byte, on splitting this I will get 3 and B.The...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.