if you only want to get the string before '['. try ...
string str = "Computer[comp]";
str = str.Substring(0, str.IndexOf("["));
if there are multiple "[]" in your string try this.
string str = "Comp[cooom] makes [power] one cry";
string[] array = str.Split(']');
string finishedString = string.Empty;
foreach (string member in array)
{
if (member.Contains("["))
finishedString += member.Substring(0, member.IndexOf("["));
else
finishedString += member;
}
Regards,
On Dec 25, 6:49 pm, "Luuk" <l...@invalid.lanwrote:
"RP" <rpk.gene...@gmail.comschreef in berichtnews:9e**********************************@i 29g2000prf.googlegroups.com...
I have a string in the following format
Computer [comp]
I want to remove the text that starts with [. Though I used substring
which keeps checking whether the character is [ and stops reading more
characters. I want to know is there any built-in function for this
that is both fast and easy to use.
google:http://www.google.com/search?source=...arp+substring&...
1st link:http://en.csharp-online.net/Manipula...arp%E2%80%94Fi...
(because you're obviously tooo lazy to start Google in the 1st place...)