Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hi guys.. how can i trim string from a textbox for example.. i have a text "hello:sdsdfdsf",my problem is i want to seperate all text from the textbox starting from :sign to the right..but i dont think im gonna be able to get it.. again.. sori for my bad english guys..

sample input "hello:world"
sample output"world"
Posted

I can show this in C# and you can convert it to VB, concept is the same...

C#
string input = "hello:world";
string output = "";

if (input.Contains(":"))
{
    output = input.Split(':')[1];   
}


Or...

C#
output = input.Substring(input.IndexOf(':') + 1);
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 24-Jul-13 10:06am    
Sure, a 5.
—SA
You are not "trimming" your text, you want to Split it.

http://msdn.microsoft.com/en-us/library/system.string.split.aspx[^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 24-Jul-13 10:05am    
Should be enough to solve the problem, my 5, but... yes, it can be called trimming, why not? The ultimate output is the trimmed input...
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900