String split by Newline in VB.NET
if String is in this format
Dim str as String = "1)ABS2)SIGN
3)MOD
4)FLOOR
5)CEIL
6)ROUND
7)EXP
8)LOG
9)LOG10
10)POW
11)POWER
12)SQRT
13)PI
14)COS
15)SIN
16)TAN"
Split string by new line -> then by ')' get exact Strings
1) Split by Newline
User can split by "\r\n" or System.Environment.NewLine
Dim array() As String = str.Split(New String() {"\r\n"}
, StringSplitOptions.RemoveEmptyEntries)
Dim s As String
For Each s In array
Console.WriteLine(s)
final+=s.Split(New Char()
{
")"c
}
, StringSplitOptions.RemoveEmptyEntries)(1)+" "
Next
OUTPUT
Dim finalwords() As String = final.Split(New String() {" "}
, StringSplitOptions.RemoveEmptyEntries)
Array.Sort(finalwords)
Dim i As Integer = 0
Dim f As String
For Each f In finalwords
Console.Write(f + "\t")
Next
1)ABS
2)SIGN
3)MOD
4)FLOOR
5)CEIL
6)ROUND
7)EXP
8)LOG
9)LOG10
10)POW
11)POWER
12)SQRT
13)PI
14)COS
15)SIN
16)TAN
2)SIGN
3)MOD
4)FLOOR
5)CEIL
6)ROUND
7)EXP
8)LOG
9)LOG10
10)POW
11)POWER
12)SQRT
13)PI
14)COS
15)SIN
16)TAN
2) Split String by ')' character
, StringSplitOptions.RemoveEmptyEntries)
Array.Sort(finalwords)
Dim i As Integer = 0
Dim f As String
For Each f In finalwords
Console.Write(f + "\t")
Next
FINAL OUTPUT:
ABS SIGN MOD FLOOR CEIL ROUND EXP LOG LOG10 POW POWER SQRT PI COS SIN TAN
ABS CEIL COS EXP FLOOR LOG LOG10 MOD PI POW
POWER ROUND SIGN SIN SQRT TAN
ABS CEIL COS EXP FLOOR LOG LOG10 MOD PI POW
POWER ROUND SIGN SIN SQRT TAN
Tags:String
split by Newline in VB.NET,String split by '\r\n',String Split by
System.Environment.NewLine. Split Strings in VB.NET,Split a String on Line
Breaks,Split a String on carriage Return
You have a good point here!I totally agree with what you have said!!Thanks for sharing your views...hope more people will read this article!!! read
ReplyDelete