VB.Net

VB.Net Strings

VB.Net Strings

Strings can be used as an array of characters in VB.Net; however, when you declare itYou and the String keyword is more commonly used to declare a string variable. The string keyword is an alias for the class System.String.

Create a String Object

You can make a string object by using one of the techniques listed below.

  • By putting a string literal into a String variable
  • Using the String class's function Object() { [native code] }
  • By employing the string concatenation operator (+), you can create a new string.
  • By obtaining a property or invoking a method that returns a string
  • By invoking a formatting method to transform a value or object to a string representation

Properties of the String Class

The String class has the following two properties −

Sr.No

Property Name & Description

1

Chars

Gets the Char object in the current String object at a specified position.

2

Length

Gets the number of characters in the current String object.

Methods of the String Class

The String class has many methods that help in working with the string objects like 

Public Shared Function Compare ( strA As String, strB As String ) As Integer, Public Shared Function Concat ( str0 As String, str1 As String, str2 As String ) As String, Public Function Contains ( value As String ) As Boolean, and many more. A complete list of methods and string class constructors can be obtained from the MSDN library.

Top course recommendations for you

    Bitcoin for Beginners
    1 hrs
    Beginner
    6K+ Learners
    4.49  (338)
    Pygame Basics
    1 hrs
    Beginner
    4.8K+ Learners
    4.37  (119)
    Inheritance in Java
    1 hrs
    Beginner
    3.7K+ Learners
    4.63  (142)
    Tic Tac Toe Python
    1 hrs
    Beginner
    2.2K+ Learners
    4.64  (58)
    Anaconda Python
    2 hrs
    Beginner
    2.6K+ Learners
    4.62  (105)
    Operators in MySQL
    2 hrs
    Beginner
    6.6K+ Learners
    4.51  (239)
    Advanced SQL
    1 hrs
    Intermediate
    20.2K+ Learners
    4.49  (921)
    Errors in Java Programming
    2 hrs
    Beginner
    2.6K+ Learners
    4.49  (65)
    Python IDLE
    1 hrs
    Beginner
    1.5K+ Learners
    4.71  (21)
    Python vs R
    3 hrs
    Beginner
    1.5K+ Learners
    4.57  (46)