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.9K+ Learners
    4.54  (438)
    Pygame Basics
    1 hrs
    Beginner
    5.8K+ Learners
    4.37  (206)
    Inheritance in Java
    1 hrs
    Beginner
    4.6K+ Learners
    4.49  (285)
    Tic Tac Toe Python
    1 hrs
    Beginner
    2.7K+ Learners
    4.51  (81)
    Anaconda Python
    2 hrs
    Beginner
    3.8K+ Learners
    4.37  (310)
    Operators in MySQL
    2 hrs
    Beginner
    8.2K+ Learners
    4.5  (477)
    Advanced SQL
    1 hrs
    Intermediate
    29.1K+ Learners
    4.48  (2250)
    Python IDLE
    1 hrs
    Beginner
    4K+ Learners
    4.46  (423)