how can I get the number whithin the brackets?

I have the following text and I want to get the number within the brackets..

HSBC BANK MIDDLE EAST [547628]

how can I do that




Answer this question

how can I get the number whithin the brackets?

  • traderhen

    string full = "HSBC BANK MIDDLE EAST [547628]";

    string number = full.Substring(full.IndexOf("[") + 1);

    number = number.Substring(0, number.Length - 1);



  • how can I get the number whithin the brackets?