Gerry Viator <vi*****@musc.edu> wrote:
I want to remove this [878454]: With a string function? Can I use the Astric
as wild card? If not, how?
Dim txtstr as String = "Print Report for MRN [878454] from B Database"
txtstr = txtstr.Replace("[*]","")
You could either use regular expressions, or find the first index of
the '[', then the first index of ']' after that, and remove that
section. Here's the regex:
using System;
using System.Text.RegularExpressions;
class Test
{
static void Main()
{
string test = "Print Report for MRN [878454] from B Database";
Regex regex = new Regex(@"\[.*\]");
Console.WriteLine (regex.Replace(test, ""));
}
}
Note that you end up with a double space in the middle that way.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too