Thread: Dissecting a string to grab a number.

  1. #1
    Registered User
    Join Date
    Dec 2011
    Posts
    3

    Dissecting a string to grab a number.

    I have the line:

    "System.Windows.Forms.Button, Text: 6"
    and I want to pull out the 6 into a variable X to use in a like like:

    textBox1->Text = Convert::ToString(X);

    It was so easy in VB (-:
    Last edited by Emerogork; 12-29-2011 at 01:12 AM. Reason: to make it more prittier.

  2. #2
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    It's simple in C++ too.
    FAQ - Cprogramming.com

  3. #3
    Registered User
    Join Date
    Dec 2011
    Posts
    3
    Quote Originally Posted by whiteflags View Post
    It's simple in C++ too.
    FAQ - Cprogramming.com
    You don't know either?

  4. #4
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    I linked you to the FAQ of the parent site. Are you going to make me do it for you or are you going to make an attempt to do it yourself? If you read the FAQ about converting a string to an int, you should have a good place to start. Stringstreams can parse the most complex strings if you think about what you're doing.

  5. #5
    Registered User
    Join Date
    Dec 2011
    Posts
    3

    Nuff said,...

    Quote Originally Posted by whiteflags View Post
    I linked you to the FAQ of the parent site. Are you going to make me do it for you or are you going to make an attempt to do it yourself? If you read the FAQ about converting a string to an int, you should have a good place to start. Stringstreams can parse the most complex strings if you think about what you're doing.
    Yea, I was told that this site is nothing more than a Fallon Saturday Night Live skit.. Its ok, I will go where there are users that are willing to be supporting..

  6. #6
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    What more do you want from me?

  7. #7
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Emerogork
    I will go where there are users that are willing to be supporting.
    You want to go to a place where people will spoon feed you like a baby? Excellent! Good riddance

    *thread closed*
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 12
    Last Post: 03-07-2011, 01:24 AM
  2. Dissecting an Excel XML spreadsheet
    By desmond5 in forum C++ Programming
    Replies: 1
    Last Post: 05-22-2008, 04:32 PM
  3. Dissecting numbers
    By jmajeremy in forum C++ Programming
    Replies: 19
    Last Post: 01-03-2007, 10:17 PM
  4. grab rgb
    By dP munky in forum Tech Board
    Replies: 4
    Last Post: 04-04-2003, 12:39 PM
  5. Dissecting a string...
    By Unregistered in forum C Programming
    Replies: 5
    Last Post: 11-18-2001, 07:37 PM