By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,776 Members | 1,351 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,776 IT Pros & Developers. It's quick & easy.

About selection of first 10 characters

P: 1
i have a series like
case 1) AS123-6889-98 ---
case 2) CDGH-4564-4569887

1)Now it should select first 10 characters including special characters
2)Now it should select till (CDGH-4564)
it should select till -
same code should be there for both.
Sep 3 '14 #1
Share this Question
Share on Google+
2 Replies

P: 82
You can use the String.Remove method to do this.

Expand|Select|Wrap|Line Numbers
  1.         Dim str As String = "CDGH-4564-4569887"
  2.         str = str.Remove(9) 'removes all characters after the 9th character
  3.         MessageBox.Show(str) 'displays "CDGH-4564"
msdn link to the String.Remove method.
Sep 3 '14 #2

Expert Mod 5K+
P: 9,731
Please checkout the topic of Regular Expressions.

Here are some resources to get you started:
Sep 16 '14 #3

Post your reply

Sign in to post your reply or Sign up for a free account.