Page 1 of 1

ResultArray

Posted: Sat Dec 19, 2009 3:42 pm
by Kjell
:idea:

Let's share some ResultArray tricks.

Code: Select all

int byte4(int P)
{
  return String[P]-48;
}

int byte8(int P)
{
  return byte4(P)*10+
         byte4(P+1);
}

int byteX(int P, int L)
{
  int X = 0;

  for(int B=P; B<P+L; ++B)
  {
    X += byte4(P+L-B-1)*pow(10,B);
  }

  return X;
}

// converts unix timestamp to int

int timestamp()
{
  return byteX(0,10);
}

// converts date("his") to int

int date()
{
  return byte8(0)*3600+
         byte8(2)*60+
         byte8(4);
}
* This message will self destruct as soon as ZGE supports Strings :wink:

K