+92 332 4229 857 99ProjectIdeas@Gmail.com

String.EndsWith function (Vb.net)


String EndsWith function
String.EndsWith() function is used to check whether the specified string ends on your desired input character or not. 
System.String is the library for this function.
 
Example1
Dim str1 As String = "Saad Bin Saulat"
MsgBox(str1.EndsWith("t"))
Result
The message box will returns true because the string str1 is ending on small "t".

Example2
Dim str1 As String = "Saad Bin Saulat"
MsgBox(str1.EndsWith("T"))
Result
The message box will returns false because the string str1 is not ending on capital "T", hence ending on small "t".

Example3
Dim str1 As String = "Saad Bin Saulat"
MsgBox(str1.EndsWith("T", StringComparison.InvariantCultureIgnoreCase))
Result
The message box will returns true because the due to StringComparison.InvariantCultureIgnoreCase parameter, EndsWith() function now only checks the letter not the case.


Related articles

0 comments: