How to get the Characters between two given integers.
For example i have a String "I am ,learning, Vb.net", now i want to get the word "learning" out of this string.
Want command should i use.Remember that there are two commas in the String.
Printable View
How to get the Characters between two given integers.
For example i have a String "I am ,learning, Vb.net", now i want to get the word "learning" out of this string.
Want command should i use.Remember that there are two commas in the String.
Your example seems off - it doesn't contain any integers.
VB Code:
Dim temp As String = "I am, learning, vb.net" Dim extraction As String = temp.Substring(temp.IndexOf("learning"),"learning".Length)
ok that was great
But what if i have "i have ,2036, pages in this book"
Now if the integer 2036 is different everytime then how to get that 2036 from this string.
For example at first time it is 2036 and if i click button again and then the String is "i have ,480661, pages in this book". how to get this integer out from this string.
VB Code:
'vb Dim temp As String = "this is me learning, 2036, pages of .Net"; Dim startIndex As Integer = temp.IndexOf(",") + 1; Dim endIndex As Integer = temp.IndexOf(",",startIndex); Dim extraction As String = temp.Substring(startIndex,endIndex-startIndex).Trim; 'c# int startIndex = temp.IndexOf(",") + 1; int endIndex = temp.IndexOf(",",startIndex); string r = temp.Substring(startIndex,endIndex-startIndex).Trim();