Vulcan.NET Code Examples

For a screen shot of the code below running, please click here.

Vulcan.NET  Clipper Style Code
FUNCTION Start() AS VOID
    LOCAL nNumber AS FLOAT

    // Transform examples
    ? Transform(123.45,"@B 99999.99")
    ? Transform(3.45,"@B 99999.99")
    ? Transform(123.45,"@C 99999.99")
    ? Transform(-123.45,"@X 99999.99")
    ? Transform(123.45,"@Z 99999.99")
    ? Transform(0,"@Z 99999.99")
    ? Transform(0,"99999.99")
    ? Transform(-123.45,"@( 99999.99")
    ? Transform(-123.45,"@(XC 99999.99")

    // Date/time examples
    ? ElapTime("03:02:01", "09:09:09")        // 06:07:08
    ? ElapTime("09:05:12", "23:10:07")        // 14:04:55

    ? Time24(), AmPm(Time24())
    SetAMExt(" am")
    SetPMExt(" pm")
    SetAMPM(TRUE)

    ? Today(), DToS(Today()), DToC(Today()), DoW(Today()), Day(Today()), CDoW(Today())

    ? Days(300000)
    ? TString(303600)
    ? TString(10400)


    // String examples
    ? "1234567890123456"
    ? Str(5.4500,12,-1)
    ? Str(123.458,12,2)
    ? Str(234.4563456456,12,-1)
    ? Str(234.4563456456,12,2)
    ? Str(23.5,10,5)

    SetScience(TRUE)
    ? Str(353425234.56746,-1)

    nNumber := 123.45

    ? Str(nNumber)                           // 123.45
    ? Str(nNumber, 4)                        // 123.
    ? Str(nNumber, 2)                        // **
    ? Str(nNumber * 10, 7, 2)                // 1234.50
    ? Str(nNumber * 10, 12, 4)               // 1234.5000
    ? Str(nNumber, 10, 1)                    // 123.5

    ? Str(123.45, -1)                        // 123.45
    ? Str(123.45, -1, 2)                     // 123.45
    ? Str(0.45000, 14, -1)                   // 0.45000
    ? Str(5.45000, 14, -1)                   // 5.45000
    ? Str(5.4500, 14, -1)                    // 5.4500

    //	 Insert
    ? Stuff("ABCDEF", 2, 0, "xyz")            // AxyzBCDEF

    //	 Replace
    ? Stuff("ABCDEF", 2, 3, "xyz")            // AxyzEF

    //	 Delete
    ? Stuff("ABCDEF", 2, 2, "")               // ADEF

    //	 Replace and insert
    ? Stuff("ABCDEF", 2, 1, "xyz")            // AxyzCDEF

    //	 Replace and delete
    ? Stuff("ABCDEF", 2, 4, "xyz")            // AxyzF

    //	 Replace and delete rest
    ? Stuff("ABCDEF", 2, 10, "xyz")            // Axyz


    RETURN