5 Functions
5 Functions
net/publication/351198059
CITATIONS READS
0 1,118
3 authors, including:
Some of the authors of this publication are also working on these related projects:
Exploring the Relationship between MIS and Decision-Making Process atAl-Hussein Bin Talal University View project
All content following this page was uploaded by Ali M. Al-Ghonmein on 30 April 2021.
Len (string): Returns an integer that contains the number of characters in a string.
Left (string , number of characters): Returns a string containing a specified number of characters
from the left side of a string.
Mid (string , start , number of characters) :Returns a string containing a specified number of
characters from a string.
Examples
Ucase (string) تحويل حروف النص الى احرف كبيرة
Print Ucase("Computer") ➔COMPUTER
Print Ucase(" abXYZ123&# ") ➔ABXYZ123&#
Dim x As String
x = "Ahu2012 " : Print UCase(x) ➔AHU2012
==========================================================
Lcase (string) تحويل حروف النص الى احرف صغيرة
Print Lcase("Computer") ➔computer
Print Lcase(" abXYZ123&# ") ➔abxyz123&#
Dim x As String
x = "ABcd2012 " : Print LCase(x) ➔ abcd2012
Examples
Len ( string ) )ايجاد عدد احرف النص ( طول النص
Print len(" Computer ") ➔ 8
Print len(" abXY Z123&# ") ➔ 11
Dim x As String
x = "Ahu2012 " : Print len(x) ➔ 7
==========================================================
Left ( string , number of characters) ارجاع االحرف من جهة الشمال
Print left(" Ali and ahmad ",9) ➔ Ali and a احرف9 طباعة اول
Dim X as string
X= "Mohanad" : print left(x,5) ➔ Mohan احرف5 طباعة اول
Dim x as string
Dim n as integer=3
X="Mohammad"
Print left(x,n) ➔Moh
Examples
Right(string , number of characters) ارجاع االحرف من جهة اليمين
Print Right(" Ali and ahmad ",9) ➔ and ahmad ) احرف من اليمين9( احرف9 طباعة آخر
Dim X as string
X= "Mohanad" : print Right(x,5) ➔ hanad ) احرف من اليمين5( احرف5 طباعة آخر
Dim x as string
Dim n as integer=3
X="Mohammad"
Print Right(x,n) ➔ mad
Print Left(UCase("Computer"), 5) ➔COMPU
Print Right(Left(Mid("Computer ", 1, 2), 2), 3) ➔ CO
Print len (Right(Left(Mid("Computer ", 1, 2), 2), 3)) ➔ 2
Examples
Mid ( String , start , number of character )
Print Mid(“ABCDabcdXYZ”,3,4) ➔CDab حروف4 من الحرف الثالث ابدأ وإرجاع
Dim x as string
X=“Welcome to Jordan”
Print Mid(x,3,7) ➔ lcome t
Print Mid(“ABcdeXYZ”,3) ➔cdeXYZ
Print mid(“ABC”,2,4) ➔BC
Dim x as string
Dim n as integer=3
X="Mohammad"
Print Mid(x,n,n) ➔ham
Examples
Print len(Right(Left( Mid("Computer", 1, 2), 2), 3)) ➔ 2
Print Len(left("ABCDEF",4)) ➔4
Print right(left("abcdxyz",4),2) ➔ cd
Print Mid(Right("ABCXYZ",4),3,2) ➔ YZ
Print Lcase(Mid("123456",2,1)) ➔2
Print right(left("Jordan",5),2) ➔ da
Print Lcase(Mid(left("abcABC*&#",9),3,4) ➔ cabc
Print left(ucase("Computer"),5) ➔ COMPU
Print Right(left(Mid("Computer",1,2),2),3) ➔ Co
Print Left(Right(Mid("Computer", 1, 4), 2), 3) ➔ mp
Print UCase(Left(Right(Mid("Computer", 1, 4), 2), 3)) ➔MP
Trace the following program?
Private Sub Command1_Click()
Print UCase("ABcdxXyZ123")
Print LCase("AbcdefhXYZ")
Print Len("Computer skills(2)")
Print Left("Computer", 4)
Print Right("Computer", 5)
Print Mid("Computer", 2, 4)
Print Right(Left(Mid("computer", 2, 5), 4), 2)
End Sub
Mathematics Functions
ABS(n) :returns the absolute value of n. اقتران القيمة المطلقة
SQR (n):return the square root of n. اقتران الجذر التربيعي
MOD : Divides two numbers and returns the remainder. اقتران باقي القسمة
INT(n) :The largest integer less than or equal to n. اقتران أكبر عدد صحيح
FIX(n) : The integer part of n. اقتران الجزء الصحيح
Rnd(n) :generate a random number between (0 and 1). اقتران القيمة العشوائية
VAL(n): convert a string value to number. تحول النص الى القيمة الرقمية المقابلة له
STR(n) : convert a number to a string value. تحول الرقم الى القيمة النصية
CHR(n) : returns the string corresponding to an ASCII value.
Abs function
ABS (n): ) يعطي هذا االقتران القيمة المطلقة (يحول القيمة السالبة الى قيمة موجبة
Print Now
Print Date
Print Time
End Sub
Date and Time Functions
◼ Time :
Print time ‘02:41:11 pm
◼ Date :
Print date ‘19/10/2011
◼ Now :
Print now ‘19/10/2011 02:41:11 pm
Examples
Write a suitable code to show the following output The string is “Computer”
Hint: use ( left , right , mid,ucase )
Co
M
puter
UT
R
Print 2 mod 3 ➔2
Print 1+2 mod 3 *6 ➔3
Print ucase(Mid("computer", 1, 14)) ➔COMPUTER
Print Mid(“ABCDEF", 0, 6) ➔ERROR
Print Mid(“ABCDFXZ", 5, 0) ➔ Print nothing
Print Mid(Chr(97) & UCase("example"), Len("M"), Val(3)) ➔ aEX
Print Round(2.276, 2) ➔ 2.28
Print Round(2.276, 1) ➔ 2.3