Sri Lanka .NET Forum
a mission and a vision with .NET

problem

rated by 0 users
This post has 2 Replies | 2 Followers

Not Ranked
Posts 5
chichi Posted: 02-07-2010 11:29 AM

how to get number stored in string type values ?that values also contain characters("n12344")

 

  • Filed under:
Not Ranked
Posts 3

This may not the perfect solution. But it may give an idea to how to solve your problem.

 

private void button1_Click(object sender, EventArgs e)
        {
            string ss = "N1234";
            char[] test = ss.ToCharArray();
            int length = ss.Length;
            for (int i = 0; i < length; i++)
            {
                if (!isNumeric(testIdea.ToString()))
                {
                    ss = ss.Remove(i, 1);
                }
            }

           
            MessageBox.Show(ss);
        }

        private bool isNumeric(string text)
        {
            int result;

            return int.TryParse(text,out result);
        }

||:.<IROSHAN>.:||

Top 500 Contributor
Posts 9

hi,

In  VB you can remove character

            Dim strString As String = "N12344"
            Dim strResalt As String
            strResalt = strString.Remove("N")

Page 1 of 1 (3 items) | RSS
This space is available for you to advertise. Please contact admin@dotnetforum.lk for more details on how to advertise on the .NET Forum.
Copyright © Sri Lanka .NET Forum. All Rights Reserved. Terms of Use | Privacy Policy