SlideShare a Scribd company logo
1 of 5
AUTHOR: MOHAMMED ABDEL KHALEQ DWIKAT EMAIL:dwikatmo@gmail.com
TOPIC: VB (I) / ARITHMETIC LOGICAL OPERATIONS DATE: 1/31/2020 PAGE: 1 OF 5
VISUAL BASIC (II)
AN NAJAH NATIONAL UNIVERSITY
MANAGEMENT INFORMATION SYSTEMS
PREPARED BY :
MOHAMMED ABDEL KHALEQ DWIKAT
dwikatmo@najah.edu
facebook.com/dwikatmo
dwikatmo@gmail.com
31/01/2020
STRING CLASS
AUTHOR: MOHAMMED ABDEL KHALEQ DWIKAT EMAIL:dwikatmo@gmail.com
TOPIC: VB (I) / ARITHMETIC LOGICAL OPERATIONS DATE: 1/31/2020 PAGE: 2 OF 5
STRING METHODS
Dim S as String = "Good Morning"
Method Name Value
S.Length /This is a property 12 Number of characters
S.Substring(8) ning 9th character & after it
S.Substring(5, 3) Mor Start from 6th , 3 chars
S.Replace("o", "i") Giid Mirning Replace o with i
S.Remove(1, 2) Gd Morning Remove 2nd 3rd letters
S.ToUpper() GOOD MOORNING Change to CAPS
S.ToLower() good morning Change to Small
S.indexOf("d") 3 Location of d
S.IndexOf("o") 1 Location of 1st O
S.LastIndexOf("o") 6 Last location of o
S.Trim() Remove spaces around S
String.concat("Al","i") Ali Concating 2 texts
String.compare("a","b") False Compare 2 values
String.compare("a","a") True
String.compare("a","A") Depends on ??
S.Length : Gives the number of symbols/characters
S.Substring(8) : gives the 8th character and any leading characters
S.Substring(5, 3) : Gives 3 characters starting from position 5 –
included which are (6th,7th, and 8th characters)
S.Replace("o", "i") will replace the o with i
S.Remove(1, 2) : will remove 2 characters starting from position 1
(2nd character -Included) which are oo
S.indexOf("d"): will give the location of first occurrence of the
letter specified.
S.LastindexOf("d"): will give the location of last occurrence of the
letter specified.
S.IndexOf("o", 2): will give the position of o starting from
position 2
S.Trim(): Removes spaces before and after a string for example if s =
" Good ",its value after trim will be "Good"
AUTHOR: MOHAMMED ABDEL KHALEQ DWIKAT EMAIL:dwikatmo@gmail.com
TOPIC: VB (I) / ARITHMETIC LOGICAL OPERATIONS DATE: 1/31/2020 PAGE: 3 OF 5
Method Name What it does
S.Insert(3, "W") Insert letter W, in 4th location
S.Remove(5, 4) Remove 4 characters starting at 6th location
S = S.Replace("A", "H") Replace any A with H
Dim S As String
S = "Two or more Students"
T1.Text = S & vbCrLf
S = S.Insert(11, " distinct")
T1.Text = T1.Text & S & vbCrLf
S = S.Remove(0, 7)
T1.Text = T1.Text & S & vbCrLf
S = S.Replace("S", "s")
T1.Text = T1.Text & S & vbCrLf
T1.Text = T1.Text.Replace("i", "O")
As Textbox is considered as a class, its Text value also is considered
as a class, so we can treate all previous methods and apply them on
T1.text as follows
You can replace any string variable above by T1.text
In T1, replace ant I with O
T1.Text = T1.Text.Replace("i", "O"), and so on for other methods.
Change all content of T1 to Capital Letters
T1.text=T1.text.ToUpper
Change all content of T1 to Small Letters
T1.text=T1.text.ToLower
Extra methods that applied to T1 directly (but not to a string
variable or T1.text)
Having a textbox T1, then
Method Name What it does
T1.cut() Cut the selected text in t1 and saves it in clipboard
T1.copy() copy the selected text in t1 and saves it in clipboard
T1.paset() Paste the text from clipboard into current location in t1
T1.clear() Clears/deletes all the contents of T1
Create a textbox on a form, implement the previous methods on it.
AUTHOR: MOHAMMED ABDEL KHALEQ DWIKAT EMAIL:dwikatmo@gmail.com
TOPIC: VB (I) / ARITHMETIC LOGICAL OPERATIONS DATE: 1/31/2020 PAGE: 4 OF 5
Question: Validate an email address to be valid before leaving a
textbox, if it is not correct, go back to T1.
Email address like dwikatmo@najah.edu
Write a function that counts the occurrences of a specified character
in a string.
For example, if we have s = "duplicate id’s is done by adding the
same id as many times as we can", and we want to count how
many d exist in S. the output will be
The function returns d occurred 6 times
Write a function that validate a Jawwal phone number written in a
textbox, valid phone number as 0599565816.
First 3 characters should be 059
Total number of digits should be 10 exactly.
How to deal with numbers as text
Numbers could be treated as text (Not vice versa)
Question: having a three digit number like 784, find ones here it is
4,tens here it is 8, and hundreds here it is 7 of that number
784 = 7 hundreds + 8 tens + 4 ones
Dim N As Integer, S As String
N = Val (T1.Text)
S = N.ToString("00#")
Dim Ones As Byte, Tens As Byte, Hundreds As Byte
Ones = S.Substring(2, 1)
Tens = S.Substring(1, 1)
Hundreds = S.Substring(0, 1)
You can solve it recursively buy using Mod
Function SumDigits(N As Integer) As Integer
Dim Temp As Integer, Remainder As Integer
Temp = N Mod 10
Remainder = (N - Temp) / 10
If Remainder = 0 Then Return Temp
Return Temp + SumDigits(Remainder)
End Function
Question: depending on previous question, write a function NumToWord
that Accept a 3-digit integer number, then return its equivalent in
English words as string. For example the function will accept 784 as
parameter, and return a string which is Seven Hundreds eighty four
AUTHOR: MOHAMMED ABDEL KHALEQ DWIKAT EMAIL:dwikatmo@gmail.com
TOPIC: VB (I) / ARITHMETIC LOGICAL OPERATIONS DATE: 1/31/2020 PAGE: 5 OF 5
Hint: You may create 3 functions and gather the result or one function
with an array of individual numbers by using a loop.
Reverse Integer 5478 becomes 8745
Function ReverseInteger(N As Integer) As String
Dim Temp As Integer, Remainder As Integer
Temp = N Mod 10
Remainder = (N - Temp) / 10
If Remainder = 0 Then Return Temp
Return Temp & ReverseInteger(Remainder)
End Function

More Related Content

What's hot

Numerical on dichotomous search
Numerical on dichotomous searchNumerical on dichotomous search
Numerical on dichotomous searchSumita Das
 
Numerical on bisection method
Numerical on bisection methodNumerical on bisection method
Numerical on bisection methodSumita Das
 
String in c programming
String in c programmingString in c programming
String in c programmingDevan Thakur
 
primitive data types
 primitive data types primitive data types
primitive data typesJadavsejal
 
Strinng Classes in c++
Strinng Classes in c++Strinng Classes in c++
Strinng Classes in c++Vikash Dhal
 
Assignment 7
Assignment 7Assignment 7
Assignment 7IIUM
 
Implementation Of String Functions In C
Implementation Of String Functions In CImplementation Of String Functions In C
Implementation Of String Functions In CFazila Sadia
 
Character Array and String
Character Array and StringCharacter Array and String
Character Array and StringTasnima Hamid
 
Bucket sort- A Noncomparision Algorithm
Bucket sort- A Noncomparision AlgorithmBucket sort- A Noncomparision Algorithm
Bucket sort- A Noncomparision AlgorithmKrupali Mistry
 
Expression Notes
Expression NotesExpression Notes
Expression Notesbujols
 
Variables & Data Types in R
Variables & Data Types in RVariables & Data Types in R
Variables & Data Types in RRsquared Academy
 

What's hot (20)

Numerical on dichotomous search
Numerical on dichotomous searchNumerical on dichotomous search
Numerical on dichotomous search
 
Strings in c language
Strings in  c languageStrings in  c language
Strings in c language
 
Mbd2
Mbd2Mbd2
Mbd2
 
Numerical on bisection method
Numerical on bisection methodNumerical on bisection method
Numerical on bisection method
 
Strings IN C
Strings IN CStrings IN C
Strings IN C
 
String in c programming
String in c programmingString in c programming
String in c programming
 
Strings
StringsStrings
Strings
 
primitive data types
 primitive data types primitive data types
primitive data types
 
Strinng Classes in c++
Strinng Classes in c++Strinng Classes in c++
Strinng Classes in c++
 
Strings in C
Strings in CStrings in C
Strings in C
 
Assignment 7
Assignment 7Assignment 7
Assignment 7
 
Golden Section method
Golden Section methodGolden Section method
Golden Section method
 
Implementation Of String Functions In C
Implementation Of String Functions In CImplementation Of String Functions In C
Implementation Of String Functions In C
 
05 c++-strings
05 c++-strings05 c++-strings
05 c++-strings
 
String c
String cString c
String c
 
Character Array and String
Character Array and StringCharacter Array and String
Character Array and String
 
Bucket sort- A Noncomparision Algorithm
Bucket sort- A Noncomparision AlgorithmBucket sort- A Noncomparision Algorithm
Bucket sort- A Noncomparision Algorithm
 
Strings
StringsStrings
Strings
 
Expression Notes
Expression NotesExpression Notes
Expression Notes
 
Variables & Data Types in R
Variables & Data Types in RVariables & Data Types in R
Variables & Data Types in R
 

Similar to Vb.net string class visual Basic .net

Functions data format
Functions data formatFunctions data format
Functions data formatgtankariagt
 
50 SDE Interview Questions.pdf
50 SDE Interview Questions.pdf50 SDE Interview Questions.pdf
50 SDE Interview Questions.pdfHeyCoach
 
Scala 3 Is Coming: Martin Odersky Shares What To Know
Scala 3 Is Coming: Martin Odersky Shares What To KnowScala 3 Is Coming: Martin Odersky Shares What To Know
Scala 3 Is Coming: Martin Odersky Shares What To KnowLightbend
 
Learning to code with Python! (Microsoft Virtual Academy).pptx
Learning to code with Python! (Microsoft Virtual Academy).pptxLearning to code with Python! (Microsoft Virtual Academy).pptx
Learning to code with Python! (Microsoft Virtual Academy).pptxJoshuaJoseph70
 
Learning to code with Python! (MVA).pptx
Learning to code with Python! (MVA).pptxLearning to code with Python! (MVA).pptx
Learning to code with Python! (MVA).pptxJoshuaJoseph70
 
Advanced functions visual Basic .net
Advanced functions visual Basic .netAdvanced functions visual Basic .net
Advanced functions visual Basic .netMohammad Dwikat
 
Built-in Functions in SQL | Numeric Functions
Built-in Functions in SQL | Numeric FunctionsBuilt-in Functions in SQL | Numeric Functions
Built-in Functions in SQL | Numeric FunctionsRaj vardhan
 
Lo27
Lo27Lo27
Lo27lksoo
 
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21chinthala Vijaya Kumar
 
Chapter 16-spreadsheet1 questions and answer
Chapter 16-spreadsheet1  questions and answerChapter 16-spreadsheet1  questions and answer
Chapter 16-spreadsheet1 questions and answerRaajTech
 
The Ring programming language version 1.10 book - Part 31 of 212
The Ring programming language version 1.10 book - Part 31 of 212The Ring programming language version 1.10 book - Part 31 of 212
The Ring programming language version 1.10 book - Part 31 of 212Mahmoud Samir Fayed
 
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...AntareepMajumder
 
Sp 1418794917
Sp 1418794917Sp 1418794917
Sp 1418794917lakshmi r
 
DEE 431 Introduction to MySql Slide 6
DEE 431 Introduction to MySql Slide 6DEE 431 Introduction to MySql Slide 6
DEE 431 Introduction to MySql Slide 6YOGESH SINGH
 

Similar to Vb.net string class visual Basic .net (20)

Functions data format
Functions data formatFunctions data format
Functions data format
 
50 SDE Interview Questions.pdf
50 SDE Interview Questions.pdf50 SDE Interview Questions.pdf
50 SDE Interview Questions.pdf
 
Unit 2
Unit 2Unit 2
Unit 2
 
Scala 3 Is Coming: Martin Odersky Shares What To Know
Scala 3 Is Coming: Martin Odersky Shares What To KnowScala 3 Is Coming: Martin Odersky Shares What To Know
Scala 3 Is Coming: Martin Odersky Shares What To Know
 
Learning to code with Python! (Microsoft Virtual Academy).pptx
Learning to code with Python! (Microsoft Virtual Academy).pptxLearning to code with Python! (Microsoft Virtual Academy).pptx
Learning to code with Python! (Microsoft Virtual Academy).pptx
 
Learning to code with Python! (MVA).pptx
Learning to code with Python! (MVA).pptxLearning to code with Python! (MVA).pptx
Learning to code with Python! (MVA).pptx
 
Advanced functions visual Basic .net
Advanced functions visual Basic .netAdvanced functions visual Basic .net
Advanced functions visual Basic .net
 
E2
E2E2
E2
 
Built-in Functions in SQL | Numeric Functions
Built-in Functions in SQL | Numeric FunctionsBuilt-in Functions in SQL | Numeric Functions
Built-in Functions in SQL | Numeric Functions
 
Lo27
Lo27Lo27
Lo27
 
05
0505
05
 
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
 
Chapter 16-spreadsheet1 questions and answer
Chapter 16-spreadsheet1  questions and answerChapter 16-spreadsheet1  questions and answer
Chapter 16-spreadsheet1 questions and answer
 
012. SQL.pdf
012. SQL.pdf012. SQL.pdf
012. SQL.pdf
 
The Ring programming language version 1.10 book - Part 31 of 212
The Ring programming language version 1.10 book - Part 31 of 212The Ring programming language version 1.10 book - Part 31 of 212
The Ring programming language version 1.10 book - Part 31 of 212
 
6.array
6.array6.array
6.array
 
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...
 
Sp 1418794917
Sp 1418794917Sp 1418794917
Sp 1418794917
 
DEE 431 Introduction to MySql Slide 6
DEE 431 Introduction to MySql Slide 6DEE 431 Introduction to MySql Slide 6
DEE 431 Introduction to MySql Slide 6
 
Scalar lenses-workshop
Scalar lenses-workshopScalar lenses-workshop
Scalar lenses-workshop
 

More from Mohammad Dwikat

Multimedia digital images
 Multimedia  digital images Multimedia  digital images
Multimedia digital imagesMohammad Dwikat
 
1 main spss all test summary (a3)
1 main spss all test summary (a3)1 main spss all test summary (a3)
1 main spss all test summary (a3)Mohammad Dwikat
 
1 main spss test summary 2020 ultimate
1 main spss test  summary 2020 ultimate1 main spss test  summary 2020 ultimate
1 main spss test summary 2020 ultimateMohammad Dwikat
 

More from Mohammad Dwikat (6)

Multimedia digital images
 Multimedia  digital images Multimedia  digital images
Multimedia digital images
 
Digital audio
Digital audioDigital audio
Digital audio
 
Forms visual Basic .net
Forms visual Basic .netForms visual Basic .net
Forms visual Basic .net
 
1 main spss all test summary (a3)
1 main spss all test summary (a3)1 main spss all test summary (a3)
1 main spss all test summary (a3)
 
1 main spss test summary 2020 ultimate
1 main spss test  summary 2020 ultimate1 main spss test  summary 2020 ultimate
1 main spss test summary 2020 ultimate
 
0 intro to multimegia
0 intro to multimegia0 intro to multimegia
0 intro to multimegia
 

Recently uploaded

Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsNbelano25
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactisticshameyhk98
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
latest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answerslatest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answersdalebeck957
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 

Recently uploaded (20)

Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactistics
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
latest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answerslatest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answers
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 

Vb.net string class visual Basic .net

  • 1. AUTHOR: MOHAMMED ABDEL KHALEQ DWIKAT EMAIL:dwikatmo@gmail.com TOPIC: VB (I) / ARITHMETIC LOGICAL OPERATIONS DATE: 1/31/2020 PAGE: 1 OF 5 VISUAL BASIC (II) AN NAJAH NATIONAL UNIVERSITY MANAGEMENT INFORMATION SYSTEMS PREPARED BY : MOHAMMED ABDEL KHALEQ DWIKAT dwikatmo@najah.edu facebook.com/dwikatmo dwikatmo@gmail.com 31/01/2020 STRING CLASS
  • 2. AUTHOR: MOHAMMED ABDEL KHALEQ DWIKAT EMAIL:dwikatmo@gmail.com TOPIC: VB (I) / ARITHMETIC LOGICAL OPERATIONS DATE: 1/31/2020 PAGE: 2 OF 5 STRING METHODS Dim S as String = "Good Morning" Method Name Value S.Length /This is a property 12 Number of characters S.Substring(8) ning 9th character & after it S.Substring(5, 3) Mor Start from 6th , 3 chars S.Replace("o", "i") Giid Mirning Replace o with i S.Remove(1, 2) Gd Morning Remove 2nd 3rd letters S.ToUpper() GOOD MOORNING Change to CAPS S.ToLower() good morning Change to Small S.indexOf("d") 3 Location of d S.IndexOf("o") 1 Location of 1st O S.LastIndexOf("o") 6 Last location of o S.Trim() Remove spaces around S String.concat("Al","i") Ali Concating 2 texts String.compare("a","b") False Compare 2 values String.compare("a","a") True String.compare("a","A") Depends on ?? S.Length : Gives the number of symbols/characters S.Substring(8) : gives the 8th character and any leading characters S.Substring(5, 3) : Gives 3 characters starting from position 5 – included which are (6th,7th, and 8th characters) S.Replace("o", "i") will replace the o with i S.Remove(1, 2) : will remove 2 characters starting from position 1 (2nd character -Included) which are oo S.indexOf("d"): will give the location of first occurrence of the letter specified. S.LastindexOf("d"): will give the location of last occurrence of the letter specified. S.IndexOf("o", 2): will give the position of o starting from position 2 S.Trim(): Removes spaces before and after a string for example if s = " Good ",its value after trim will be "Good"
  • 3. AUTHOR: MOHAMMED ABDEL KHALEQ DWIKAT EMAIL:dwikatmo@gmail.com TOPIC: VB (I) / ARITHMETIC LOGICAL OPERATIONS DATE: 1/31/2020 PAGE: 3 OF 5 Method Name What it does S.Insert(3, "W") Insert letter W, in 4th location S.Remove(5, 4) Remove 4 characters starting at 6th location S = S.Replace("A", "H") Replace any A with H Dim S As String S = "Two or more Students" T1.Text = S & vbCrLf S = S.Insert(11, " distinct") T1.Text = T1.Text & S & vbCrLf S = S.Remove(0, 7) T1.Text = T1.Text & S & vbCrLf S = S.Replace("S", "s") T1.Text = T1.Text & S & vbCrLf T1.Text = T1.Text.Replace("i", "O") As Textbox is considered as a class, its Text value also is considered as a class, so we can treate all previous methods and apply them on T1.text as follows You can replace any string variable above by T1.text In T1, replace ant I with O T1.Text = T1.Text.Replace("i", "O"), and so on for other methods. Change all content of T1 to Capital Letters T1.text=T1.text.ToUpper Change all content of T1 to Small Letters T1.text=T1.text.ToLower Extra methods that applied to T1 directly (but not to a string variable or T1.text) Having a textbox T1, then Method Name What it does T1.cut() Cut the selected text in t1 and saves it in clipboard T1.copy() copy the selected text in t1 and saves it in clipboard T1.paset() Paste the text from clipboard into current location in t1 T1.clear() Clears/deletes all the contents of T1 Create a textbox on a form, implement the previous methods on it.
  • 4. AUTHOR: MOHAMMED ABDEL KHALEQ DWIKAT EMAIL:dwikatmo@gmail.com TOPIC: VB (I) / ARITHMETIC LOGICAL OPERATIONS DATE: 1/31/2020 PAGE: 4 OF 5 Question: Validate an email address to be valid before leaving a textbox, if it is not correct, go back to T1. Email address like dwikatmo@najah.edu Write a function that counts the occurrences of a specified character in a string. For example, if we have s = "duplicate id’s is done by adding the same id as many times as we can", and we want to count how many d exist in S. the output will be The function returns d occurred 6 times Write a function that validate a Jawwal phone number written in a textbox, valid phone number as 0599565816. First 3 characters should be 059 Total number of digits should be 10 exactly. How to deal with numbers as text Numbers could be treated as text (Not vice versa) Question: having a three digit number like 784, find ones here it is 4,tens here it is 8, and hundreds here it is 7 of that number 784 = 7 hundreds + 8 tens + 4 ones Dim N As Integer, S As String N = Val (T1.Text) S = N.ToString("00#") Dim Ones As Byte, Tens As Byte, Hundreds As Byte Ones = S.Substring(2, 1) Tens = S.Substring(1, 1) Hundreds = S.Substring(0, 1) You can solve it recursively buy using Mod Function SumDigits(N As Integer) As Integer Dim Temp As Integer, Remainder As Integer Temp = N Mod 10 Remainder = (N - Temp) / 10 If Remainder = 0 Then Return Temp Return Temp + SumDigits(Remainder) End Function Question: depending on previous question, write a function NumToWord that Accept a 3-digit integer number, then return its equivalent in English words as string. For example the function will accept 784 as parameter, and return a string which is Seven Hundreds eighty four
  • 5. AUTHOR: MOHAMMED ABDEL KHALEQ DWIKAT EMAIL:dwikatmo@gmail.com TOPIC: VB (I) / ARITHMETIC LOGICAL OPERATIONS DATE: 1/31/2020 PAGE: 5 OF 5 Hint: You may create 3 functions and gather the result or one function with an array of individual numbers by using a loop. Reverse Integer 5478 becomes 8745 Function ReverseInteger(N As Integer) As String Dim Temp As Integer, Remainder As Integer Temp = N Mod 10 Remainder = (N - Temp) / 10 If Remainder = 0 Then Return Temp Return Temp & ReverseInteger(Remainder) End Function