|
A lookup table, I guess.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
String[] text=originalText.Split(" ");
int[] intArray=new int[text.length];
for(int i=0;i<text.length;i++)
intArray[i]=Convert.toInt32(text[i]);
-- modified at 13:46 Saturday 3rd February, 2007
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[^]
|
|
|
|
|
That depends on what the text contains and how you want to convert it. Do you want to convert each character to it's character code, or does the text contain the textual representation of numbers in any form, that you want to parse?
Does you text look something like this?
"123, 4, 18, 4, 11, 93"
Or something like this?
"123-4-18-4-11-93"
Or something like this?
"4A 10 f8 fe 08 0f"
Or something like this?
"4A10f8fe080f"
Or something like this?
"007, 053, 016, 024, 004, 103"
Or something like this?
"Hello world!"
---
single minded; short sighted; long gone;
|
|
|
|
|
Thank you everyone for your help. I actually meant to post this message in the vb.net section. I hadn't had to do this conversion in a long time so I forgot the function for doing it. I just rememebered today the asc() function in vb.net does this. Although I'm not sure if it would work for any unicode characters.
I'll also try a vb form of the c code you gave me Thomas. That might work if I ever have to deal with a unicode character.
I appreciate everyones help,
Mike
|
|
|
|
|
The Asc function will work just fine with Unicode characters, despite it's name. ASCII was brand new when BASIC was created back in 1963, but now it's kind of outdated...
You should move on into the .NET world, though, and just convert the character to an integer as Thomas suggested. That's what the Asc function does anyway, it's just a wrapper for the real .NET method.
---
single minded; short sighted; long gone;
|
|
|
|
|
The code I wrote was written in Visual C# so it should be easier to convert to VB than if it was in C (which I don't even know ). The code is also is not specific to unicode characters. The Convert.toInt32(Object obj) is a standard method in the .NET framework.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
What about this:
Int32 x = Int32.Parse(string);
|
|
|
|
|
In DataGridView, I'm wanting to create a column of buttons with bitmap faces instead of text. No sweat doing the buttons using DataGridViewButtonColumn. However, I've not found a simple way to put a bitmap or icon on the button face. Anyone done this?
|
|
|
|
|
I am working with large bitmaps (in the range of 5000x5000 pixels) and found no support for loading the image with gray scale. The only supported 4 and 8 bit format is colour, what I found online was the 16 bit format doesn't work. Using a gray scale conversion after the fact was very time consuming. In the end I changed the palette of the 8 bit format using the following code
ColorPalette pal = segyBMP.Palette;
int j = 255;
for (int i = 0; i < pal.Entries.Length; i++)
{
pal.Entries[i] = Color.FromArgb(j, j, j);
j--;
}
segyBMP.Palette = pal;
(The decrementing j is to reverse the black/white - saves me else where is the code.)
Does anyone know if there is a gray scale palette already in the system so I wouldn't have to make my own? Or a better way to handle the gray scale issue? I don't want/need colour and size does matter. I want to keep it to 8 or maybe 4 bit format.
Jim
-- modified at 13:20 Friday 2nd February, 2007
|
|
|
|
|
AFAIK there are no ready-made palettes whatsoever, and I cannot imagine a simpler
way to construct the one you are using.
I trust you use images with PixelFormat=Format8bppIndexed.
Luc Pattyn
|
|
|
|
|
jimwawar wrote: The only supported 4 and 8 bit format is colour, what I found online was the 16 bit format doesn't work.
Interesting. The 16 bit format is interesting, because it stores partial color values. However, it certainly 'works'. 4 and 8 bit have palettes, anything higher, doesn't. My image processing articles show how to convert 24/32 bit to greyscale, making it work with 16 bit is pretty easy.
jimwawar wrote: Does anyone know if there is a gray scale palette already in the system so I wouldn't have to make my own?
No, a palette is just a palette.
jimwawar wrote: I don't want/need colour and size does matter. I want to keep it to 8 or maybe 4 bit format.
I'd be inclined to convert to 24 bit, convert to gray with a color matrix, and convert back. I'm not sure which would be faster, but that seems less error prone.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi ,
I am using a property grid to show some controls property and dynamically set them.I want to remove some property or customized some choosed property .How can I do this.Please help me.It is urgent.
thanks in Advance
Sandy
|
|
|
|
|
If it's urgent, then learn to use google. It is not good form to say that something is urgent, because while it's urgent for you it doesn't affect me one way or the other. Why should I be inconvenienced by your lack of planning?
As a hint, take a look at BrowsableAttribute.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi, all!
I have a following problem, and i can't find a right solution.
Description:
There is a COM server written on C++ and it works through IDispatch and it does't have a TYPELIB. And from another side there is a COM client developed on C#. Through LATE BINDING it uses a COM server
and COM server sends different events to client, but i can't implement COM event handling mechanism.
Please, anybody can help me?!
Thanks in advance!
|
|
|
|
|
how to insert undeletable image in word document
Please h
Arun Kr
|
|
|
|
|
OK. First of all, navigate to the top right hand corner of this web page. Do you see the text highlighted in red? That says .Net Framework and not Microsoft Office. You can probably guess where I'm going with this.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hello All,
I have a client app which is in .NET 1.0 and i have to work on a webservice, i was
wondering if i can write the webservice in 2.0. In this case, will the WSE 3.0 for the
webservice and WSE 2.0 for the client app in .NET 1.0 still work. Or it won't.
Help Me !!
Ankit Sharma
|
|
|
|
|
I'm writing a database class , I need to use a table variable from within .Net (C#), but it always gives an SQLException saying "Must declare the table variable '@Par1'."
1. I declared an SQLParameter object
2. I added the object to the 'Parameters' collection of the command
How can I solve this
|
|
|
|
|
What's the 'Exit For' equivalent in C#?
|
|
|
|
|
|
|
Most times when you use this it indicates that you have used the wrong construct. If you are issuing a break then this shows that you have reached a terminating condition.
If you need to drop out of a loop early, this would indicate that you should be using something like a while loop instead. See the following:
for (int i = 0; i < 10 ; i++)
{
if (i == 2) break;
}
Contrast this with:
int i = 0;
while (i++ != 2)
{
}
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete O'Hanlon wrote: If you need to drop out of a loop early, this would indicate that you should be using something like a while loop instead.
Or a different for expression
Node n = null;
NodeList list = doc.selectNodes("*");
for(int j=0, null == n && j < list.Length, j++)
{
if( ???)
n = list[j];
}
led mike
|
|
|
|
|
Ya, Ya, we all know the theory; but break is more handier
|
|
|
|
|
Handy doesn't make it right. Just lazy. If you take shortcuts here, where else do you take shortcuts? Whenever I see something like this, it sets the alarm bells ringing that there are problems with the design.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|