This a rather simple question for all you studs out there! Please help me
with this. I have a string = "Please help me", and I want to convert this
into it's hex equivalent. How do I do it, I have trying for a couple hours
and can't seem to get my head straight arount this whole conversion things.
TIA, LCD 6 43210
Not sure exactly what you want to do but check out the Hex Function, Convert
Class, and ToCharArray string method. One or all of these in combination
should get you what you want.
--
Dennis in Houston
"LCD" wrote: This a rather simple question for all you studs out there! Please help me with this. I have a string = "Please help me", and I want to convert this into it's hex equivalent. How do I do it, I have trying for a couple hours and can't seem to get my head straight arount this whole conversion things.
TIA, LCD
Okay I want to doing something similar to this. In python, there is a
function called "binascii".
So if I type:
### binascii.hexlif y('hello world')
This is the result I get:
'68656c6c6f2077 6f726c64'
###
I want to do something similar in VB.NET or C#. Can someone help?
"Dennis" wrote:
Not sure exactly what you want to do but check out the Hex Function, Convert Class, and ToCharArray string method. One or all of these in combination should get you what you want. -- Dennis in Houston
"LCD" wrote:
This a rather simple question for all you studs out there! Please help me with this. I have a string = "Please help me", and I want to convert this into it's hex equivalent. How do I do it, I have trying for a couple hours and can't seem to get my head straight arount this whole conversion things.
TIA, LCD
Dim str As String = "hello world"
Dim byteArray() As Byte
byteArray = System.Text.ASC IIEncoding.ASCI I.GetBytes(str)
"LCD" wrote: Okay I want to doing something similar to this. In python, there is a function called "binascii".
So if I type: ### binascii.hexlif y('hello world')
This is the result I get:
'68656c6c6f2077 6f726c64' ###
I want to do something similar in VB.NET or C#. Can someone help?
"Dennis" wrote:
Not sure exactly what you want to do but check out the Hex Function, Convert Class, and ToCharArray string method. One or all of these in combination should get you what you want. -- Dennis in Houston
"LCD" wrote:
This a rather simple question for all you studs out there! Please help me with this. I have a string = "Please help me", and I want to convert this into it's hex equivalent. How do I do it, I have trying for a couple hours and can't seem to get my head straight arount this whole conversion things.
TIA, LCD
I just realized you are probably asking for the ascii values of each
character of a string in hex format. This should do it for you:
Dim str As String = "hello world"
Dim byteArray() As Byte
Dim hexNumbers As System.Text.Str ingBuilder = New System.Text.Str ingBuilder
byteArray = System.Text.ASC IIEncoding.ASCI I.GetBytes(str)
For i As Integer = 0 To byteArray.Lengt h - 1
hexNumbers.Appe nd(byteArray(i) .ToString("x"))
Next
MessageBox.Show (hexNumbers.ToS tring())
The output should be:
68656c6c6f20776 f726c64
"rmacias" wrote: Dim str As String = "hello world" Dim byteArray() As Byte
byteArray = System.Text.ASC IIEncoding.ASCI I.GetBytes(str)
"LCD" wrote:
Okay I want to doing something similar to this. In python, there is a function called "binascii".
So if I type: ###>> binascii.hexlif y('hello world')
This is the result I get:
'68656c6c6f2077 6f726c64' ###
I want to do something similar in VB.NET or C#. Can someone help?
"Dennis" wrote:
Not sure exactly what you want to do but check out the Hex Function, Convert Class, and ToCharArray string method. One or all of these in combination should get you what you want. -- Dennis in Houston
"LCD" wrote:
> This a rather simple question for all you studs out there! Please help me > with this. I have a string = "Please help me", and I want to convert this > into it's hex equivalent. How do I do it, I have trying for a couple hours > and can't seem to get my head straight arount this whole conversion things. > > TIA, LCD
Dude, you are genius!
You made it like POC (piece of cake). Now please explain me this, I didn't
quite catch this part:
hexNumbers.Appe nd(byteArray(i) .ToString("x"))
where is this "x" coming from? and why?
TIA, LCD
"rmacias" wrote: I just realized you are probably asking for the ascii values of each character of a string in hex format. This should do it for you:
Dim str As String = "hello world" Dim byteArray() As Byte Dim hexNumbers As System.Text.Str ingBuilder = New System.Text.Str ingBuilder
byteArray = System.Text.ASC IIEncoding.ASCI I.GetBytes(str)
For i As Integer = 0 To byteArray.Lengt h - 1 hexNumbers.Appe nd(byteArray(i) .ToString("x")) Next
MessageBox.Show (hexNumbers.ToS tring())
The output should be: 68656c6c6f20776 f726c64
"rmacias" wrote:
Dim str As String = "hello world" Dim byteArray() As Byte
byteArray = System.Text.ASC IIEncoding.ASCI I.GetBytes(str)
"LCD" wrote:
Okay I want to doing something similar to this. In python, there is a function called "binascii".
So if I type: ### >>> binascii.hexlif y('hello world')
This is the result I get:
'68656c6c6f2077 6f726c64' ###
I want to do something similar in VB.NET or C#. Can someone help?
"Dennis" wrote:
> Not sure exactly what you want to do but check out the Hex Function, Convert > Class, and ToCharArray string method. One or all of these in combination > should get you what you want. > -- > Dennis in Houston > > > "LCD" wrote: > > > This a rather simple question for all you studs out there! Please help me > > with this. I have a string = "Please help me", and I want to convert this > > into it's hex equivalent. How do I do it, I have trying for a couple hours > > and can't seem to get my head straight arount this whole conversion things. > > > > TIA, LCD
The Byte structure has several overloaded ToString() methods. The one used
below accepts a string representation of a NumberFormatInf o.
"X" or "x" means the format will be hexadecimal
"D" or "d" means the format will be in decimal, etc.
The below links shows possible formats: http://msdn.microsoft.com/library/de...classtopic.asp
"LCD" wrote: Dude, you are genius!
You made it like POC (piece of cake). Now please explain me this, I didn't quite catch this part:
hexNumbers.Appe nd(byteArray(i) .ToString("x"))
where is this "x" coming from? and why?
TIA, LCD
"rmacias" wrote:
I just realized you are probably asking for the ascii values of each character of a string in hex format. This should do it for you:
Dim str As String = "hello world" Dim byteArray() As Byte Dim hexNumbers As System.Text.Str ingBuilder = New System.Text.Str ingBuilder
byteArray = System.Text.ASC IIEncoding.ASCI I.GetBytes(str)
For i As Integer = 0 To byteArray.Lengt h - 1 hexNumbers.Appe nd(byteArray(i) .ToString("x")) Next
MessageBox.Show (hexNumbers.ToS tring())
The output should be: 68656c6c6f20776 f726c64
"rmacias" wrote:
Dim str As String = "hello world" Dim byteArray() As Byte
byteArray = System.Text.ASC IIEncoding.ASCI I.GetBytes(str)
"LCD" wrote:
> Okay I want to doing something similar to this. In python, there is a > function called "binascii". > > So if I type: > ### > >>> binascii.hexlif y('hello world') > > This is the result I get: > > '68656c6c6f2077 6f726c64' > ### > > I want to do something similar in VB.NET or C#. Can someone help? > > "Dennis" wrote: > > > Not sure exactly what you want to do but check out the Hex Function, Convert > > Class, and ToCharArray string method. One or all of these in combination > > should get you what you want. > > -- > > Dennis in Houston > > > > > > "LCD" wrote: > > > > > This a rather simple question for all you studs out there! Please help me > > > with this. I have a string = "Please help me", and I want to convert this > > > into it's hex equivalent. How do I do it, I have trying for a couple hours > > > and can't seem to get my head straight arount this whole conversion things. > > > > > > TIA, LCD This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Hal Vaughan |
last post by:
If I have a byte and I convert it to string (String sData = new
String(byte bData), then convert it back (byte bData = sData.getBytes()),
will all data be intact, or do Strings have problems with bytes that are
not printable characters? I've tested this and it seems to work fine, but
I want to make sure there isn't some condition or situation I'm not aware
of that could cause problems.
I'm doing this because it's easier to do some of my...
|
by: Jonas Prismesen |
last post by:
Hi!
I have string like this:
string expr = "123/(12*3)";
And I want to actually calculate the mathematical
expression in the string. Is there an easy way do it? Or
do I have to extract all the parts from the string, which
will be difficult since the expression will change in my
app..
|
by: Gil |
last post by:
I have a string :
string A = "2";
I need to get it's integer value :
// ??
int val = A ; // ??
|
by: AlexFarokhyans |
last post by:
Hello,
I'm trying to convert String to Char array. I'm getting a string from
user input text box and then I have char firstName.
I need to convert the string that is in the text box to
firstName.
Thank you
|
by: rainmaker1234 |
last post by:
Its very simple in VC++. In the followeing code I have declared a
String, and a double than I am taking the string and converting it into
Double. getch() at the end is only to pause the screen so you can see
the result.
#include <conio.h>
#include <iostream>
using namespace std;
void main ()
| |
by: Sandra |
last post by:
I am trying to convert a string into a uniqueidentifier by using the following code
string contrID = Request.Params["oId"
SqlGuid sqlID = SqlGuid.Parse(contrID
I am then putting sqlID into my SQL WHERE clause so it only pulls that record. I've double checked that the record I'm trying to pull is in the database. I am getting the error below. I don't understand what is causing it, Any Help is appreciated!!!!!!
ArgumentNull_String...
|
by: mdawoodk |
last post by:
i am getting error "input string was not in correct format" when
converting a string decimal into integer value.
code is like this:
string strVal = "";
int nVal = 0;
strVal = "14.9";
nVal += Convert.toInt32(strVal);
|
by: SMichal |
last post by:
Hi, how can I parse string "? 20.000" to double ?
|
by: coconet |
last post by:
I have a string like this
mystring = "color1:blue;color2:red";
I am tring to convert this into an IDictionary populated like this:
color1 blue
color2 red
My non-working syntax is
|
by: kronus |
last post by:
I'm receiving an xml file that has a child called modified and it represents a date value in the form of a string -- Nov 14, 2008 -- and in my app, I have items associated with each object and I'm trying to sort them by the date modified field.
So what's the problem, right?
Well, obviously Sep 14, 2008 is before Nov 14, 2008, but when doing a sort process, ActionScript will come back with Nov coming before Sep, because N comes before S in...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |