Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Gavascript Parseint()
Hi at all,
please can you translate the javascript Parseint() function to a clipper
language

In particular  How can I translate to Clipper 5.3:

wDay = parseInt(wDay, 10)
if (isNaN(wDay))
wDay = 0

Steel



Report this thread to moderator Post Follow-up to this message
Old Post
Steel
03-29-05 01:55 PM


Re: Gavascript Parseint()
"Steel" <SteelNOSPAM@hotmail.com> wrote:

> please can you translate the javascript Parseint() function to a clipper
> language

Not in the general case; that is, not in any bases apart from decimal.

> wDay = parseInt(wDay, 10)
> if (isNaN(wDay))
> wDay = 0

This snippet, though, parses only decimal numbers anyway, and the
Clipper val() returns 0 as its error value in the first place, so you
can simply do

day=val(day)

Do note that this does parse "123aaa" as 123; and does parse "123.45" as
123.45. If you only want integers, you can always ask for int(val(day)).
Unfortunately, if you want to make sure there are no non-digits in the
string you'll have to make sure of this yourself; if you get the string
from user input, a @get with a picture consisting of 9s or #s will not
let the user enter non-numeric data in the first place.

Richard

Report this thread to moderator Post Follow-up to this message
Old Post
Richard Bos
03-29-05 08:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Clipper archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:48 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.