I want to get characters for given ascii codes. Dont wanna use the CHR or
ChrW functions. What r the .NET equivilents of the Chr & ChrW functions?
Regards,
Abubakar.
Nov 20 '05
39 2588
thanx for the nice reply and I understand your confusion about y I would
want to avoid it. Actually as a developer in a software company I'm a big
fan of C# but I 'm sometimes forced to use vb.net for some apps/libs by my
team. I program all my code by using only .net classes and not any language
specific functions. In C# I'm more close to doing this as u know that its a
new language and made specifically for .net. In vb however these extra
fucntions are avilable which r not part of .net class library but r specific
to vb. Now since I switch languages often it is very comfortable for me if I
know how things are done in .net instead of how they r done in vb.net or any
other programming language.
"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message
news:#X******** ******@TK2MSFTN GP09.phx.gbl... Abubakar, You do realize that ChrW is inlined as IL by the VB.NET compiler, if you give it an integer constant? Which means that you can use ChrW with Char & String Constants!
It only calls into microsoft.visua lbasic.dll if you give it a variable parameter!
Of course you need to import the namespace in either case.
Initial tests suggest that AscW is always inlined for chars! And is only calls microsoft.visua lbasic.dll for String variables.
If you don't believe me check the IL produced with ILDASM.EXE.
I would recommend using ChrW! Seems a little naive to avoid ALL the functions in Microsoft.Visua lBasic, especially considering ALL the
functions are valid .NET!!! Usable from C# & other .NET languages as equally well as VB.NET! Hell! its even installed as part of the framework itself!
Hope this helps Jay
"Abubakar" <em**********@y ahoo.com> wrote in message news:OC******** ******@TK2MSFTN GP12.phx.gbl... Why would do you not want to use those?
because they require a reference to microsoft.visua lbasic.dll, and I
dont use that. I always program by removing its reference from project "imports". I dont use anything that comes from the vb dll. Like for example,
instead of using the old mid function I'll use the substring function of the string class. Wanna b more close to .net that the language.
"Cor" <no*@non.com> wrote in message news:eP******** ******@TK2MSFTN GP09.phx.gbl... Hi Abukar,
The Chr and the ChrW are normal functions in the Net the same as the + the + and the =.
Why would do you not want to use those?
Cor
"Abubakar" <em**********@y ahoo.com> schrieb Why would do you not want to use those?
because they require a reference to microsoft.visua lbasic.dll, and I dont use that. I always program by removing its reference from project "imports". I dont use anything that comes from the vb dll.
Then don't using system.windows. forms.dll because it is also a part of the
framework just like microsoft.visua lbasic.dll. Maybe you mix it up with
microsoft.visua lbasic.compatib ility.dll which should only be used for
upgraded projects.
Like for example, instead of using the old mid function I'll use the substring function of the string class. Wanna b more close to .net that the language.
It is a .NET assembly.
What is the replacement for the Right function in the Framework?
--
Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> schrieb [...] I really don't know why anyone would want to avoid ChrW & AscW personally,
I also use chr (/chrw).
as my other post suggests, they are in-lined by the VB.NET compiler itself most of the time! In other words VB.NET doesn't even wait for the JIT compiler to possible inline them, it does it itself!
Good point.
--
Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
Hi Akubar,
I see you are a C# expert, can you give me the C# function to translate a
byte with a value 65 to a Char "A" and also for the translation of a Char
with a value "A" to 65?
I am looking for that.
:-)
Cor thanx for the nice reply and I understand your confusion about y I would want to avoid it. Actually as a developer in a software company I'm a big fan of C# but I 'm sometimes forced to use vb.net for some apps/libs by my team. I program all my code by using only .net classes and not any
language specific functions. In C# I'm more close to doing this as u know that its
a new language and made specifically for .net. In vb however these extra fucntions are avilable which r not part of .net class library but r
specific to vb. Now since I switch languages often it is very comfortable for me if
I know how things are done in .net instead of how they r done in vb.net or
any other programming language.
> Then don't using system.windows. forms.dll because it is also a part of the framework just like microsoft.visua lbasic.dll. Maybe you mix it up with
umm, let me say it like this that windows.forms.d ll is the default thing
that every language will use for windows apps, right, may it be cobol, perl,
C#, c++, vb etc etc. But the functions that r specific to VB.net r not the
defualt functions that all languages use. This is the point. I'm one of
those developers who switch between .net languages in there projects.
Basically I need everything from .net which can be used from every language.
Ofcourse the microsoft.visua lbasic.dll is managed and can be refernced from
any other language and its functions called, but I dont want it this way,
for example if I 'm used to using cobol's native functions which r inside
say somecompany.cob ol.dll, I dont want to refernce it in C# and use them.
So the solution is that I'm going to use, say for this thread, encoding
class which is a part of .net which all language developers can use without
thinking that its inside the C# dll or vb dll or cobol etc,, its just going
to be there whenever whichever language u need it from. So again, I wanna be
more close to .net instead of any language so I'll feel more comfortable
using different langauges. And by the way, havnt you heard this, that to be
and good developer in .net you need to be good at .net base class library
than knowing the language..
"Armin Zingler" <az*******@free net.de> wrote in message
news:#U******** *****@TK2MSFTNG P12.phx.gbl... "Abubakar" <em**********@y ahoo.com> schrieb Why would do you not want to use those?
because they require a reference to microsoft.visua lbasic.dll, and I dont use that. I always program by removing its reference from project "imports". I dont use anything that comes from the vb dll.
Then don't using system.windows. forms.dll because it is also a part of the framework just like microsoft.visua lbasic.dll. Maybe you mix it up with microsoft.visua lbasic.compatib ility.dll which should only be used for upgraded projects.
Like for example, instead of using the old mid function I'll use the substring function of the string class. Wanna b more close to .net that the language.
It is a .NET assembly.
What is the replacement for the Right function in the Framework?
-- Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
Hi Abubakar,
You are not good in a language if you can translate a instruction in another
language instruction.
You are good in it if you can use the benefits from it.
My old sample is the benchmark test I once saw.
Someone had made a Algol Sort in Cobol.
He showed that he did need more lines in Cobol than in Algol and that it was
in Algol faster.
But he did not use the Cobol instruction Sort because that was not in Algol.
My 2 Euro cents about this
Cor
> You are good in it if you can use the benefits from it.
I'm trying to take benefit from .net bcl not vb. But he did not use the Cobol instruction Sort because that was not in
Algol.
exactly,,,, if I'm using the C# or say Cobol the second day I dont want to
find myself looking for Chr equivilents in the new language when I know that
there was a .net equivilent.
And these r the things which .net solved. Language interoperabilit y. Again,
be "more" good at BCL, languages r not that important in .net. All r RAD,
all are jitted, all r controlled by CLR.
"Cor" <no*@non.com> wrote in message
news:uX******** ******@TK2MSFTN GP12.phx.gbl... Hi Abubakar,
You are not good in a language if you can translate a instruction in
another language instruction. You are good in it if you can use the benefits from it.
My old sample is the benchmark test I once saw.
Someone had made a Algol Sort in Cobol.
He showed that he did need more lines in Cobol than in Algol and that it
was in Algol faster.
But he did not use the Cobol instruction Sort because that was not in
Algol. My 2 Euro cents about this
Cor
"Abubakar" <em**********@y ahoo.com> schrieb Then don't using system.windows. forms.dll because it is also a part of the framework just like microsoft.visua lbasic.dll. Maybe you mix it up with umm, let me say it like this that windows.forms.d ll is the default thing that every language will use for windows apps, right, may it be cobol, perl, C#, c++, vb etc etc. But the functions that r specific to VB.net r not the defualt functions that all languages use. This is the point. I'm one of those developers who switch between .net languages in there projects. Basically I need everything from .net which can be used from every language. Ofcourse the microsoft.visua lbasic.dll is managed and can be refernced from any other language and its functions called, but I dont want it this way, for example if I 'm used to using cobol's native functions which r inside say somecompany.cob ol.dll, I dont want to refernce it in C# and use them.
So the solution is that I'm going to use, say for this thread, encoding class which is a part of .net which all language developers can use without thinking that its inside the C# dll or vb dll or cobol etc,, its just going to be there whenever whichever language u need it from. So again, I wanna be more close to .net instead of any language so I'll feel more comfortable using different langauges. And by the way, havnt you heard this, that to be and good developer in .net you need to be good at .net base class library than knowing the language..
I think I understand you. Despite, what is wrong in using language specific
features? For example, you can create code comments in C#. Would you refuse
to use them in C# just because they are not available in Vb.NET? Same thing
for other features like unsafe blocks.
On the other side I agree that MSVB.DLL functions that are _only_ wrapper
functions for other Framework function and don't provide additional
features, should not be used. But, for example, the Right function is not a
part of the String class - one of the very few examples.
--
Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
:) well I can hardly be a C# expert, but here's what u r looking for:
byte b= 65;
char a= 'A';
MessageBox.Show ( ((char)b).ToStr ing() );
MessageBox.Show ( ((int)a).ToStri ng());
The first messagebox is showing you the translation from 65(byte type) to
"A" char type and than to string for showing in a message box. The second
messagebox is showing u a translation from "A" to int 65 and than to string
for the purpose of showing it in messagebox because that expects string.
Casting does the magic.
"Cor" <no*@non.com> wrote in message
news:uH******** ******@TK2MSFTN GP11.phx.gbl... Hi Akubar,
I see you are a C# expert, can you give me the C# function to translate a byte with a value 65 to a Char "A" and also for the translation of a Char with a value "A" to 65?
I am looking for that.
:-)
Cor
thanx for the nice reply and I understand your confusion about y I would want to avoid it. Actually as a developer in a software company I'm a
big fan of C# but I 'm sometimes forced to use vb.net for some apps/libs by
my team. I program all my code by using only .net classes and not any language specific functions. In C# I'm more close to doing this as u know that
its a new language and made specifically for .net. In vb however these extra fucntions are avilable which r not part of .net class library but r specific to vb. Now since I switch languages often it is very comfortable for me
if I know how things are done in .net instead of how they r done in vb.net or any other programming language.
> features, should not be used. But, for example, the Right function is not
a part of the String class - one of the very few examples.
As I said that I never use Mid, because I know that string class has its
equivilent substring function which also is used inplace of right or left
functions. And that'll be true for all .net compliant languages and its so
exciting to realize that I already know that whatever .net language I'll use
in the future will have a string type for handling strings and they'll have
a substring functionality and most of my confusions or problems already gets
solved just because of .net's common type system feature. I remember about 3
years ago I had to make a small project in delphi (approx 1 month coding
time) and I was meeting with delphi programmers most of the time and asking
them how to do conversions and how to use pointers and other stuff. Just an
example.
[...] Same thing for other features like unsafe blocks.
yes , unsafe is not CLSCompliant and I would not use it.
[...] For example, you can create code comments in C#. Would you refuse to use them in C# just because they are not available in Vb.NET? Same
thing
well C# code comments is another thing, it helps me to document my code and
thats a very nice feature specific to C# but it does not stop me from
writing code if its not present in VB, I'll just not be able to use it
throuhg VB.
"Armin Zingler" <az*******@free net.de> wrote in message
news:em******** *****@TK2MSFTNG P12.phx.gbl... "Abubakar" <em**********@y ahoo.com> schrieb Then don't using system.windows. forms.dll because it is also a part of the framework just like microsoft.visua lbasic.dll. Maybe you mix it up with umm, let me say it like this that windows.forms.d ll is the default thing that every language will use for windows apps, right, may it be cobol, perl, C#, c++, vb etc etc. But the functions that r specific to VB.net r not the defualt functions that all languages use. This is the point. I'm one of those developers who switch between .net languages in there projects. Basically I need everything from .net which can be used from every language. Ofcourse the microsoft.visua lbasic.dll is managed and can be refernced from any other language and its functions called, but I dont want it this way, for example if I 'm used to using cobol's native functions which r inside say somecompany.cob ol.dll, I dont want to refernce it in C# and use them.
So the solution is that I'm going to use, say for this thread, encoding class which is a part of .net which all language developers can use without thinking that its inside the C# dll or vb dll or cobol etc,, its just going to be there whenever whichever language u need it from. So again, I wanna be more close to .net instead of any language so I'll feel more comfortable using different langauges. And by the way, havnt you heard this, that to be and good developer in .net you need to be good at .net base class library than knowing the language..
I think I understand you. Despite, what is wrong in using language
specific features? For example, you can create code comments in C#. Would you
refuse to use them in C# just because they are not available in Vb.NET? Same
thing for other features like unsafe blocks.
On the other side I agree that MSVB.DLL functions that are _only_ wrapper functions for other Framework function and don't provide additional features, should not be used. But, for example, the Right function is not
a part of the String class - one of the very few examples.
-- Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: chandy |
last post by:
Hi,
I have an Html document that declares that it uses the utf-8 character
set. As this document is editable via a web interface I need to make
sure than high-ascii characters that may be accidentally entered are
properly represented when the document is served. My programming
language allows me to get the ascii value for any individual character
so what I am doing when a change is saved is to look at each character
in the content and...
|
by: Martn Marconcini |
last post by:
Hello there,
I'm writting (or trying to) a Console Application in C#. I has to be
console.
I remember back in the old days of Cobol (Unisys), Clipper and even Basic,
I used to use a program (its name i cannot recall now...) where I designed
the "screen" using this "program" and then saved it into an ASCII file.
(thus, using 'extended' ASCII's like Lines, Corners, etc. and making
screens look nicer and more professional). Then reading a...
|
by: Kai Bohli |
last post by:
Hi all !
I need to translate a string to Ascii and return a string again. The code below dosen't work for
Ascii (Superset) codes above 127. Any help are greatly appreciated.
protected internal string StringToAscii(string S)
{
byte strArray = Encoding.UTF7.GetBytes(S);
string NewString = Encoding.UTF7.GetString(strArray);
|
by: Ger |
last post by:
I have not been able to find a simple, straight forward Unicode to ASCII
string conversion function in VB.Net.
Is that because such a function does not exists or do I overlook it?
I found Encoding.Convert, but that needs byte arrays.
Thanks,
/Ger
|
by: Mark Rae |
last post by:
Hi,
I'm in the process if converting the data out of an old DOS-based
SunAccounts system (don't ask!) into SQL Server.
The data has been sent to me as a collection of hundreds of SunAccounts
backup files and it's a simple (yet extremely laborious!) process of opening
each backup file in turn, reading the file line by line, splitting it up
into its constituent parts, and then squirting it into SQL Server.
| |
by: pamelafluente |
last post by:
I have found on the web a post with this useful way to convert (if
possible) a ScanCode to Ascii. This is remarkably useful to filter keys
under KeyDown/up event.
My problem is that I am not familiar with Platform Invoke and this code
(vb6) needs just a little adjustment (types) to work in VB.NET.
Would anyone be so kind as to show the necessary changes?
Thank you very much in advance!!
|
by: Claude Yih |
last post by:
Hi, everyone. I got a question. How can I identify whether a file is a
binary file or an ascii text file? For instance, I wrote a piece of
code and saved as "Test.c". I knew it was an ascii text file. Then
after compilation, I got a "Test" file and it was a binary executable
file. The problem is, I know the type of those two files in my mind
because I executed the process of compilation, but how can I make the
computer know the type of a...
|
by: Jeffrey Spoon |
last post by:
Hello, I'm a bit stuck trying to convert a text file which contains
extended ASCII text and changing the ASCII values so they become
readable. I do this by subtracting 127 from the ASCII value. However, at
the moment I am just getting more gibberish so I'm probably doing
something wrong. I tried using ASCII Encoding before to get the ASCII
values. Although this worked for 0-127 ASCII values, extended ASCII gave
strange values (such as 1992...
|
by: =?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?= |
last post by:
PEP 1 specifies that PEP authors need to collect feedback from the
community. As the author of PEP 3131, I'd like to encourage comments
to the PEP included below, either here (comp.lang.python), or to
python-3000@python.org
In summary, this PEP proposes to allow non-ASCII letters as
identifiers in Python. If the PEP is accepted, the following
identifiers would also become valid as class, function, or
variable names: Löffelstiel,...
|
by: =?Utf-8?B?RGFu?= |
last post by:
I have the following code section that I thought would strip out all the
non-ascii characters from a string after decoding it. Unfortunately the
non-ascii characters are still in the string.
What am I doing wrong?
Dim plainText As String
plainText = "t═e"
Dim plainTextBytes() As Byte
Dim enc As Encoding = Encoding.ASCII
plainTextBytes = enc.GetBytes(plainText)
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look !
Part I. Meaning of...
| |
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |