Split a String?
-
I am having a string in format(KSERVER/Name)...Now i want only the Name,How can i split?....I dont want to use Substring method. Thanks in Advance...:rose:
-
I am having a string in format(KSERVER/Name)...Now i want only the Name,How can i split?....I dont want to use Substring method. Thanks in Advance...:rose:
Split it with
/
, you will get a string array. From that you can take name easilyAll C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
-
I am having a string in format(KSERVER/Name)...Now i want only the Name,How can i split?....I dont want to use Substring method. Thanks in Advance...:rose:
Dim arr() As String Dim n As Int16 Dim str As String = "KSERVER/Name" arr = Split(str, "/") 'using / split the sring For n = 0 To UBound(arr) MessageBox.Show(arr(n)) Next i think this code will help u. by srinivasan.s
-
I am having a string in format(KSERVER/Name)...Now i want only the Name,How can i split?....I dont want to use Substring method. Thanks in Advance...:rose:
-
I am having a string in format(KSERVER/Name)...Now i want only the Name,How can i split?....I dont want to use Substring method. Thanks in Advance...:rose:
Kasi Viswanathan wrote:
I dont want to use Substring method.
Why not? That's the most efficient way of getting a part of a string. Use the IndexOf method to get the location of the "/" character, then use Substring to get the part of the string after that:
string name = path.Substring(path.IndexOf('/') + 1);
--- "Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things." -- Douglas Adams
-
Kasi Viswanathan wrote:
I dont want to use Substring method.
Why not? That's the most efficient way of getting a part of a string. Use the IndexOf method to get the location of the "/" character, then use Substring to get the part of the string after that:
string name = path.Substring(path.IndexOf('/') + 1);
--- "Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things." -- Douglas Adams
Tanx for ur reply...:rose: