Word Reverse
Dim Name As String = "He is palying in a ground"
Dim sb1 As New StringBuilder()
Dim a() As String = Name.Split(" ")
Dim sb11 As String = ""
For Each xxx As String In a
sb11 = xxx + " " + sb11
Next
Console.Write(sb11.ToString())
// By Recerse method
Array.Reverse(a)
Console.Write(String.Join(" ", a))
String Reverse
Dim characters As Char() = Name.ToCharArray()
Dim sb As New StringBuilder()
For i As Integer = Name.Length - 1 To 0 Step -1
sb.Append(characters(i))
Next
Console.Write(sb.ToString())
////////////////
Dim x() As Integer = {1, 2, 4, 5, 6}
For i As Integer = 0 To x.Length - 1
x(i) = x(i) * 5
Console.WriteLine(x(i))
Next
Output:5 10 20 25 30
Dim Name As String = "He is palying in a ground"
Dim sb1 As New StringBuilder()
Dim a() As String = Name.Split(" ")
Dim sb11 As String = ""
For Each xxx As String In a
sb11 = xxx + " " + sb11
Next
Console.Write(sb11.ToString())
// By Recerse method
Array.Reverse(a)
Console.Write(String.Join(" ", a))
String Reverse
Dim characters As Char() = Name.ToCharArray()
Dim sb As New StringBuilder()
For i As Integer = Name.Length - 1 To 0 Step -1
sb.Append(characters(i))
Next
Console.Write(sb.ToString())
////////////////
Dim x() As Integer = {1, 2, 4, 5, 6}
For i As Integer = 0 To x.Length - 1
x(i) = x(i) * 5
Console.WriteLine(x(i))
Next
Output:5 10 20 25 30
No comments:
Post a Comment