0% found this document useful (0 votes)
2 views

Program 12(String Manipulation)

Uploaded by

kalingarajgaming
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Program 12(String Manipulation)

Uploaded by

kalingarajgaming
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

String Manipulation

Aim:

To write a visual basic program to perform String Manipulation

Procedure

Step-1:

Click Start Microsoft Visual Basic 6.0 Standard Exe Open

Step-2:

Form window will appear

Step-3

Place the 1 label box, 12 command button on form window.

Step-4

Change their the above boxes name using property window

Step-5

Write a coding on the command buttons by clicking them

Step-6

Save and Run the program using F5

Table

Object Properties Settings


Label l Caption String Manipulation
Command 1 Name cmducase
Caption UCASE
Command 2 Name cmdlcase
Caption LCASE
Command 3 Name cmdltrim
Caption LTRIM
Command 4 Name cmdrtrim
Caption RTRIM
Command 5 Name cmdleft
Caption LEFT
Command 6 Name cmdright
Caption RIGHT
Command 7 Name cmdmid
Caption MID
Command 8 Name cmdlen
Caption LEN
Command 9 Name cmdascci
Caption ASCII
Command 10 Name cmdconcat
Caption CONCAT
Command 11 Name cmdinstr
Caption INSTR
Command 12 Name cmdcmp
Caption STRCMP

Coding
Dim s1, s2, s3 As Integer

Dim str1 As String, str2 As String, str3 As String '

Private Sub cmdascii_Click()

str1 = InputBox("enter a string")

MsgBox Asc(str1)

End Sub

Private Sub cmdcmp_Click()

str1 = InputBox("enter the first string")

str2 = InputBox("Enter the second string")

s1 = StrComp(str1, str2)
If s1 = 0 Then

MsgBox "Both strings are equal"

ElseIf s1 = 1 Then

MsgBox "First string less than second string"

Else

MsgBox "First string greater than second string"

End If

End Sub

Private Sub cmdconcat_Click()

str1 = InputBox("enter the first string")

str2 = InputBox("Enter the searching string")

str3 = str1 + str2

MsgBox (str3)

End Sub

Private Sub cmdinstr_Click()

str1 = InputBox("enter the first string")

str2 = InputBox("Enter the searching string")

s1 = InStr(1, str1, str2)

MsgBox "The position of the string is:" & s1

End Sub

Private Sub cmdlcase_Click()

str1 = InputBox("enter a string")

MsgBox LCase(str1)

End Sub
Private Sub cmdleft_Click()

str1 = InputBox("enter a string")

MsgBox Left(str1, 2)

End Sub

Private Sub cmdlen_Click()

str1 = InputBox("enter a string")

MsgBox Len(str1)

End Sub

Private Sub cmdltrim_Click()

str1 = InputBox("enter a string")

MsgBox LTrim(str1)

End Sub

Private Sub cmdmid_Click()

str1 = InputBox("enter a string")

s2 = Int(InputBox("enter a string position of a string to be extracted"))

s3 = Int(InputBox("enter how many characters to be extracted"))

MsgBox Mid(str1, s2, s3)

End Sub

Private Sub cmdright_Click()

str1 = InputBox("enter a string")

MsgBox Right(str1, 2)

End Sub

Private Sub cmdrtrim_Click()

str1 = InputBox("enter a string")


MsgBox RTrim(str1)

End Sub

Private Sub cmducase_Click()

str1 = InputBox("enter a string")

MsgBox UCase(str1)

End Sub

Design window

You might also like