พื้นฐานปาสคาลพื้นฐาน rapidqเว็บภาษาไทยเว็บภาษาอังกฤษ

CONVERSION Function ( Rapid-Q BASIC )

BIN$(numeric-expression) คืนค่า เลขฐานสอง(ชนิดstring)
HEX$(numeric-expression) คืนค่าเลขฐาน 16 เป็นสตริง
CONVBASE$(string-expression, frombase, tobase)
คืนค่าเลขฐาน tobase จากเลขฐาน frombase(sting-expression) ในรูปสตริง
example
    print BIN$(25)
    print HEX$(254)
    print CONVBASE$("15", 10, 16)
    input s$ '-- รอรับการ enter

CINT/CLNG(numeric-expression) คืนค่าเลขจำนวนเต็ม เลขปัดทศนิยมตามปกติ น้อยกว่า 5 ปัดลง
ตั้งแต่ 5 ปัดขึ้น, ส่วนค่าลบเช่น -5.2 จะถูกเพิ่มค่าเป็นเท่ากับ -4 ส่วนค่า -5.9 จะถูกเพิ่มค่าเป็นเท่ากับ -5
example
    print "CINT FUNCTION"
    print CINT(21.7); " :cint(21.7)"
    print CINT(21.4); " :cint(21.4)"
    print CINT(-21.7); " :cint(-21.7)"
    print CINT(-21.4); " :cint(-21.4)"
    input s$ '-- รอรับการ enter

RGB(redvalue, greenvalue, bluevalue) คืนค่าเป็นตัวเลขที่หมายถึงค่าสีที่ใช้กำหนดส่วนต่างๆใน form
example
    dim form as qform
    form.color=RGB(255,0,0)
    form.showmodal

STR$(numeric-expression) คืนค่าเป็นสตริงจาก numeric-expr
VAL(string-expression) คืนค่า numeric จาก string-expr
example
    dim form as qform
    dim box1 as qedit, box2 as qedit
        Sub boxChg
        dim answer as integer
        answer = Val(box1.text)+Val(box2.text) '-- val คืนค่าตัวเลข(เพื่อใช้คำนวณ)จากสตริง
        form.caption = Str$( answer ) '-- str$ คืนค่าสตริง(เพื่อกำหนดค่าให้กับ caption)จากตัวเลข
        end Sub
    form.Caption = "โปรดกรอกตัวเลขที่ช่องว่างทั้งสอง"
    box1.Parent = form : box2.Parent = form
    box1.Top = 1 : box2.Top =50
    box1.onchange = boxChg : box2.onchange = boxChg
    form.center
    form.showmodal

STRF$(numeric-expression, Format%, Precision%, Digits%) คืนค่าสตริงตามรูปแบบที่กำหนด
example
    ' Please read Complete Information at Other Detailed List in Rapid-Q Documentation
    A$ = STRF$(910.35, 0, 4, 3)
    print A$
    input s$
best view with ie 5.0++, screen 600x800