qiqinuinaifen128
Programmer
Hi all
is anybody know how to check whether the string is number?
Many thanks
Singapore Swimming Lessons
is anybody know how to check whether the string is number?
Many thanks
Singapore Swimming Lessons
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
String NumStr = "1234.56";
double MyNumber;
try
{
MyNumber = StrToFloat(NumStr);
}
catch (...)
{
String ErrMsg = NumStr + " is NOT a valid number!";
Application->MessageBox(ErrMsg.c_str(), "Number Error!", mbOK);
}
#pragma hdrstop
#include <stdio.h>
#include <conio.h>
#include <string.h>
#pragma argsused
char **text;
int i;
char str[] = ": Goolie p q h k clearLeftState ;";
char *token;
char seps[] = " ";
int n;
int count;
int sign = 0;
void store()
{
text[ n ] = new char[ strlen(token) + 1 ];
strcpy( text[ n ], token );
n++;
}
//-----------------------------------------------------------------------
int main(int argc, char* argv[])
{
text = new char*[100];
token = strtok(str,seps);
while( token != NULL )
{
//printf( "%s\n", token );
store();
count++;
token = strtok( NULL, seps );
}
for (n = 0 ; n < count; n++)
{
printf("text [%d] = %s\n", n, text[n]);
}