3

I have this string :

464-138234-AVENANCE

And I need this output on three items :

 464
 138234
 AVENANCE

For first item I have try with success :

strMyString.SelectedItem.Value.Substring(0, strMyString.SelectedItem.Value.IndexOf('-'))

Output : 464

I can't to extract the two and three items :

strMyString.SelectedItem.Value.Substring(1, strMyString.SelectedItem.Value.IndexOf('-'))

The output is :

64-

Can you help me?

Thank you in advance for any help, really appreciated.

Antonio Mailtraq
  • 1,397
  • 5
  • 34
  • 82

2 Answers2

3

why not?

string msg = "464-138234-AVENANCE";
var myArray = msg.Split('-');
Sajeetharan
  • 216,225
  • 63
  • 350
  • 396
1

Try this

  string myStr="464-138234-AVENANCE";
    string[] data= myStr.Split('-');
Libin C Jacob
  • 1,108
  • 12
  • 34