NumberToDial : String;
to this
NumberWritten : DWORD;
Thanks!
--
ôżô
V e r n www.parentpresent.org
If you just want to strip out non-digit characters, you can use
a loop like this:
function DigitsOnly(const sText: string): string;
var
iChar: Integer;
iBuf: Integer;
begin
iBuf := 0;
SetLength(Result, Length(sText));
for iChar := 1 to Length(sText) do
begin
case sText[iChar] of
'0'..'9':
begin
Inc(iBuf);
Result[iBuf] := sText[iChar];
end;
end;
end;
SetLength(Result, iBuf);
end;
"vm" <v...@gte.net> wrote in message news:3b665045_2@dnews...
I see a function StrToInt64Def.
But I'm not clear of terminology
is a Dword 32 or 64 or what?
Thanks!
--
ô¿ô
V e r n www.parentpresent.org
"Grinder" <gri...@no.spam.maam.com> wrote in message
news:3b665c41$1_2@dnews...
> > ô¿ô
> I see a function StrToInt64Def.
> But I'm not clear of terminology
> is a Dword 32 or 64 or what?
DWord is 32 bit.
--
Rudy Velthuis (TeamB)
> Ok, but still
> how to convert string to dword?
If the string fits in a DWord, use StrToIntDef, or StrToInt64Def and use
the lower DWord of that (just and with $FFFFFFFF).
--
Rudy Velthuis (TeamB)
>Greetings:
>How do i convert this
>
>NumberToDial : String;
>
>to this
>NumberWritten : DWORD;
>
>Thanks!
If you want a 32 bit representation of a string then
get one of the freely available CRC32 implementations.
HyperString Library has one for Delphi. You can download
from Torry's page:
http://homepages.borland.com/torry/text.htm
just search the page for HyperString of EFD Systems
Mike
--
"Only choice is an oxymoron."
--
From there, when i click on SEE ALSO or search for Longword,
'Integer types' comes up:
.
Cardinal 0..4294967295 unsigned 32-bit
Longword 0..4294967295 unsigned 32-bit
How do i make the leap (via documentation) that says dword = longword =
integer
therefore, 'StrToIntDef' is what i am after?
Thanks!.
--
ôżô
V e r n www.parentpresent.org
"Rudy Velthuis (TeamB)" <rvel...@gmx.de> wrote in message
news:MPG.15d0bd23e...@newsgroups.borland.com...
"vm" <v...@gte.net> wrote in message news:3b674314_1@dnews...
> Perhaps it would help if you mentioned why you want to convert
> this string to an integer (of any size.)
Indeed.
But, Vern and Grinder, please don't quote entire messages.
--
Rudy Velthuis (TeamB)
If you're in Delphi 3 or earlier, this is basically true, since D3-
did not support unsigned 32-bit integer.
In Delphi 4 and higher, the types Cardinal, dword and longword are
UNsigned integers (0..4giga); whereas integer and longint are SIGNED
integers (-2giga... 2giga).
(I've been clamouring before to have delphi support the clear type
names Int16/Int32 and UInt16/UInt32 since it is certainly not obvious
that 'longword' and 'longint' hold the same number of bits but the
difference is in the signed thing.
> therefore, 'StrToIntDef' is what i am after?
No, it looks to me like you need StrToInt64(Def) to hold your 10-digit
phone numbers (you may also need to consider the requirements of
international access codes? in that case you might run up several
additional digits).
Kristofer
> In Delphi 4 and higher, the types Cardinal, dword and longword are
> UNsigned integers (0..4giga); whereas integer and longint are SIGNED
> integers (-2giga... 2giga).
Let us be precise.
LongInt and LongWord are 32-bits.
Integer and Cardinal are the natural size of an integer. In a future
release, I fully expect them to grow to be 64 bits.
DWORD is whatever Microsoft deems it to be, as translated by Borland. I
don't know if DWORD will be 32 bits or 64 bits in a 64-bit Windows OS
of the future.
--
Ray Lischner, author of Delphi in a Nutshell
http://www.tempest-sw.com
I am considering launching a major campaign for D7... <g>
Kristofer
you mean as opposed to using terms like "the signed thing?" (my own
words, <g>).
> LongInt and LongWord are 32-bits.
On a side note to these names, what do you think should
happen when 64- and 128- bit integers become the norm?
We call those "DoubleLongInt" and "QuadrupleLongInt"? <g>
[just to have a delphi native typename which fits in the sequence]
> Integer and Cardinal are the natural size of an integer. In a future
> release, I fully expect them to grow to be 64 bits.
Natural for whom? I think that 64-bit hardware and OS would
be a prerequisite.
> DWORD is whatever Microsoft deems it to be, as translated by
Borland. I
> don't know if DWORD will be 32 bits or 64 bits in a 64-bit Windows
OS
> of the future.
if they *dare* to redefine DWORD I'm going to ...
<gurgle of self-censorship>
... be disappointed.
Kristofer