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


IronRazer
P: 82
Hi,
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"
  4.  
msdn link to the String.Remove method.
http://msdn.microsoft.com/en-us/libr...vs.110%29.aspx
Sep 3 '14 #2

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


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

Post your reply

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