Download MetaTrader 5

Examples: Strings: Table of ASCII Symbols and Its Use

To add comments, please log in or register
Ask your broker to open the official channel. Thousands of traders will read the news!
MetaQuotes Software Corp.
Moderator
181349
MetaQuotes Software Corp. 2007.07.27 13:04 

New article Strings: Table of ASCII Symbols and Its Use has been published:

In this article we will analyze the table of ASCII symbols and the ways it can be used. We will also deal with some new functions, the principle of operation of which is based on the peculiarities of the ASCII table, and then we will create a new library, which will include these functions. They are quite popular in other programming languages, but they are not included into the list of built-in functions. Besides, we will examine in details the basics of working with strings. So, I think you will certainly learn something new about this useful type of data.

Author: Antoniuk Oleg

bejglee
12
bejglee 2013.06.04 09:29  

Hi,

I think, it would be better:

bool StringIsDigit(string str)
{
   bool result = true;
   int lenght = StringLen(str);
   if(lenght == 0) return(false);            <-- if it is not here, than result is true. Because while-condition (up) will be false.
   for(int i=0; i < lenght; i++)
   {
       int symbol = StringGetChar(str, i);
       if(symbol < 48 || symbol > 57)
       {
           result = false;
           break;
       }
   }
   return(result);
} 
To add comments, please log in or register