Informační tok Funkční structura Datová struktura ER model Modulová struktura Typová struktura Relační model Dokumentace


[Celkový datový model] [Funkce] [Externí rohraní] [Stavové diagramy] [Datové elementy] [Entity] [Relace]
[Databáze] [Události] [Materiály] [Generovací funkce] [Vyhodnocovací funkce] [Konfigurace] [Uživatelé] [Projekt] [Home]



Vyhodnocovací funkce
Long2IDString
(Web Publishing)


Vytvořeno: 04-16-1998 14:50:11
Poslední změna: 01-09-2003 13:31:21

Converts a LONG value into a string using a 36-base numerical system, thus reducing the string length to at most 6 characters (for 8.3 file systems!).

Modul

Module: Web Publishing

Zdrojový kód:

PROCEDURE Long2IDString(number%, BYREF id$)
BEGIN

  //Converts a passed long value into a string. The string
  //is a number of base 36 (all numbers + all letters)
  base% = 36;
  id$ = "";
  
// digit0% = 1;
// digit1% = base%; //36
// digit2% = digit1% * base%; //1296;
// digit3% = digit2% * base%; //46656;
// digit4% = digit3% * base%; //1679616;
// digit5% = digit4% * base%; //60466176;
// digit6% would be 2176782336 => maxlong is 214783648, so it is not used

  basedigit% = 60466176;

  IF number% < 0 THEN
    number% = - number%; // UnitNo in Repunits may be negative
  END

  //we have no MOD operator, so we must trick
  WHILE basedigit% <> 0 DO
    //calculate the next digit
    temp% = number% / basedigit%;
    
    //add the number to the string as appropriate
    IF temp% <= 9 THEN
      id$ = id$ + chr$(temp% + 48);
    ELSE
      id$ = id$ + chr$(temp% + 87); //actually, "+ 97 - 10"
    END
    
    //do MOD operation and move to next digit
    number% = number% - ( temp% * basedigit% );
    basedigit% = basedigit% / base%;
  END

END


Generováno: 16.10.2003 7:41 Systém: C:\Documents and Settings\hajsman\Dokumenty\Vyuka\Irs2\Projekt case40\Projekt03.csf Generováno systémem case/4/0
Vygeneroval: Administrator Soubor: C:\Documents and Settings\hajsman\Dokumenty\Vyuka\Irs2\Projekt case40\html\17690.htm (C) microTOOL GmbH 2002