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
    6.8K+ Learners
    4.52  (414)
    Pygame Basics
    1 hrs
    Beginner
    5.7K+ Learners
    4.32  (185)
    Inheritance in Java
    1 hrs
    Beginner
    4.5K+ Learners
    4.49  (268)
    Tic Tac Toe Python
    1 hrs
    Beginner
    2.7K+ Learners
    4.49  (79)
    Anaconda Python
    2 hrs
    Beginner
    3.8K+ Learners
    4.36  (297)
    Operators in MySQL
    2 hrs
    Beginner
    8.1K+ Learners
    4.48  (448)
    Advanced SQL
    1 hrs
    Intermediate
    28.6K+ Learners
    4.48  (2096)
    Python IDLE
    1 hrs
    Beginner
    3.8K+ Learners
    4.46  (393)