03 August 2025
### ✅ What is a **String** in VB.NET?
In **VB.NET**, a `String` is a **data type** used to store **textual data**, such as words, sentences, or any sequence of characters (letters, numbers, symbols, etc.).
---
### 🔤 Example of a String:
```vb.net Dim message As String = "Hello, World!" ```
Here, `message` is a variable of type `String` that holds the text `"Hello, World!"`.
---
### 🛠️ Common Uses of Strings:
1. **Storing user input**
```vb.net Dim name As String = Console.ReadLine() ```
2. **Combining (concatenating) strings**
```vb.net Dim firstName As String = "John" Dim lastName As String = "Doe" Dim fullName As String = firstName & " " & lastName ```
3. **Checking length of a string**
```vb.net Dim length As Integer = fullName.Length ```
4. **Substring operations**
```vb.net Dim part As String = fullName.Substring(0, 4) ' Gets "John" ```
5. **Replacing text**
```vb.net Dim newName As String = fullName.Replace("Doe", "Smith") ```
6. **Comparing strings**
```vb.net If name = "Admin" Then Console.WriteLine("Access Granted") End If ```
---
### 💡 Notes:
* `String` is a **reference type** in .NET. * It is **immutable**, meaning once created, its value cannot be changed directly (modifications return a new string).
---
Let me know if you want examples using string functions like `Split()`, `ToUpper()`, `Trim()`, etc.