Does anyone have a function or procedure for converting integers to
character strings?
Thank you,
John
Nov 14 '05
30 8687
On Tue, 28 Jun 2005 17:12:27 -0700, Robert Maas, see http://tinyurl.com/uh3t
<re*****@Yahoo. Com> wrote: From: "John Carroll" <or*******@yaho o.com> Does anyone have a function or procedure for converting integers to character strings? Your question is hopelessly vague. There are all sorts of mappings from integers to character strings. Here are just a few (with quote marks omitted):
Arabic numerals: Tally: Roman numerals: Cardinal: English: forty-two German: zwei und vierzig (Note: AltaVista Babelfish gets this wrong!)
So do you <g>. It's zweiundvierzig, all one word <g>.
Ordinal: Traditional base 12: English: three dozen and six
Three and a half dozen would be more likely.
Traditional by Abraham Lincoln:
Base64 (as used in HTLM/XML/etc.):
Aq==
Oh, you just want a single character? That's not possible because the range of integers is larger than the range allowed for a single character, whether a single byte (US-ASCII or Latin-1) or double byte (subset of UniCode). If you restrict the range of integers to what will fit in a single byte, then you have your choice of Latin-1 or several other system-dependent codes. If you restrict the range of integers to what will fit in 7 bits, you have your choice of US-ASCII or EBCDIC. (C provides support only for US-ASCII, via a "cast".)
No, C provides support for whatever the implementation and runtime
character sets are, which need not be US-ASCII. EBCDIC works just as
well, as does any character set which fulfils the requirements:
Section 5.2.1 "Character sets"
3 Both the basic source and basic execution character sets shall have
the following members: the 26 uppercase letters of the Latin
alphabet
A B C D E F G H I J K L M
N O P Q R S T U V W X Y Z
the 26 lowercase letters of the Latin alphabet
a b c d e f g h i j k l m
n o p q r s t u v w x y z
the 10 decimal digits
0 1 2 3 4 5 6 7 8 9
the following 29 graphic characters
! " # % & ' ( ) * + , - . / :
; < = > ? [ \ ] ^ _ { | } ~
the space character, and control characters representing horizontal
tab, vertical tab, and form feed. The representation of each member
of the source and execution basic character sets shall fit in a
byte. In both the source and execution basic character sets, the
value of each character after 0 in the above list of decimal digits
shall be one greater than the value of the previous. In source
files, there shall be some way of indicating the end of each line of
text; this International Standard treats such an end-of-line
indicator as if it were a single new-line character. In the basic
execution character set, there shall be control characters
representing alert, backspace, carriage return, and new line.
If you restrict the range of integers to 0 thru 35, you have extended IBM-hexadecimal: 0123...9ABCDE.. .XYZ. If you restrict the range to only 0 thru 15, C provides support via sprintf(&ch, "%x", intval).
If you restrict it to 0..63 you can use the Base64 encoding:
ABCDEFGHIJKLMNO PQRSTUVWXYZ
abcdefghijklmno pqrstuvwxyz
0123456789+/
Chris C This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Brad Moore |
last post by:
Hey all,
I'm getting the following compiler error from my code. I was wondering
if anyone could help me understand the concept behind it (I actually did
try and compile this degenerate example).
int foo(const char* argv) { return 0; }
int main(int argc, char* argv)
{
|
by: MilanB |
last post by:
Hello
How to convert char to int?
Thanks
|
by: Alper Akcayoz |
last post by:
Hello Esteemed Developpers
I would like to thank you in advance for your sincere responses
I am a fresh Visual C++ .NET Developer. Can you kindly guide me for How to Convert char* to System::String
|
by: Elioth |
last post by:
Hi...
I need to know how to convert Char Array to Byte Array and vice-versa in VB
2K5
Thanks for all help.
Elioth
|
by: Joah Senegal |
last post by:
Hello I need to convert a chat to a string... but I don't know how to do
this. i;ve searched the internet but I've only find some code to convert
char * to string or char to string....
but I just need char to string.
Anyone knows how to do this ?
thanks!!!!
| |
by: simon |
last post by:
I am a fresh Visual C++ .NET Developer. Can you kindly guide me for
How to Convert char to System::String
I am using windows forms and trying to set a text value referencing
the method className() of an object of class HetConvert (my own) this
returns a char - which as you can see from the code below I am trying
to pass to label1->Text - but this expects a String^
any clues anyone
|
by: Rasheed |
last post by:
Hi,
i have a char pointer buffer which will hold the bitmap buffer, So i
need to convert char *buffer as a bitmap.
becuase when i draw on the Dialog using char *buffer. Nothing will be
dispalyed.
So kindly can any body help me how to convert char *buffer to bitmap.
i want the solution in C++
|
by: helios |
last post by:
Hi all,
I'm resolved problem. and I want anybody need me that convert char to array bits
char ConvertChar2ArrayBit(char ch)
{
char Bits;
....
return Bits;
}
for example: A
after converted: 10000010
|
by: mamul |
last post by:
Hi please some one can help me. how to convert char * to string?
i have take char *argv from command line and want to pass to a function as string object(string str)
i want to first convert argv to string object of type str, then pass to function().
please help me how to convert this
|
by: DaveRook |
last post by:
Hi
I've had a few error messages with this I don't understand why. It works fine in a Windows Form, but now moving it to a website, it's not working. I don't have the option to count the lines as I did with Windows Forms so I assume the best way is to use the split method. However, the split method only returns Character Arrays, and I want a string, so am calling the split from the Text.RegularExpression namespace.
I am trying to split...
|
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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: 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: 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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |