home *** CD-ROM | disk | FTP | other *** search
- // %PARAMETERS = "CH15LIST C:\UT2004"
- //Identifies the package
- //CH15_01LIST.uc
-
- class CH15_01LIST extends Commandlet;
- function int Main(string Args){
-
- //#1
- //Define a constant
- const iELECTRACAST = 5;
-
- //Declare and array using the constant
- local string rgElectraCast[iELECTRACAST];
- //Counter for traversing an array
- local int iCtr, iLoc;
- local string szDisplay, szName;
-
- //#2 Initialize the elements of an array
- rgElectraCast[0] = "Electra";
- rgElectraCast[1] = "Orestes";
- rgElectraCast[2] = "Chrysothemis";
- rgElectraCast[3] = "Clytemnestra";
- rgElectraCast[4] = "Aegisthus";
- iLoc = 0;
-
- log(Chr(10) $ "CH15_01LIST -- Static Array" $ Chr(10));
-
- //# 3 Traversing the elements of an array
- iCtr = 0;
- for(iCtr = 0; iCtr < iELECTRACAST; iCtr++){
- Log(" rgElectraCast[" $ iCtr $ "] = " $ rgElectraCast[iCtr]);
- // #4
- //Access the elements and capitalize
- rgElectraCast[iCtr] = Caps(rgElectraCast[iCtr]);
- //Add Dashes between the letters
- while(iLoc <= Len(rgElectraCast[iCtr]) ){
- //Uncomment this to see how it works
- // Log(Left( rgElectraCast[iCtr], iLoc));
- szName $= Right( Left( rgElectraCast[iCtr], iLoc) , 1) ;
- szName $= "-";
- iLoc++;
-
- }
-
- //Make the display string
- szDisplay $= " ";
- szDisplay $= szName;
- szDisplay $= Chr(10);
- //Reset the local counter and string
- iLoc = 0;
- szName = "";
- }
-
-
- Log(Chr(10) $ szDisplay);
- return 0;
- }
-
-