Results 1 to 4 of 4

Thread: Subtracting Word From Line

  1. #1

    Thread Starter
    Lively Member DeBauer's Avatar
    Join Date
    May 2001
    Location
    Mako Reactor #7
    Posts
    123

    Question Subtracting Word From Line

    I know you can add things to a line by going + "whatever", but I wanted to know how to minus a word from a line. Lets say the line was '(Enter)> Cow' and I want to subtract the (Enter)> from the line. How would I do that? I've tried the '-' sign but I always get an error.


    Thanks.

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Dim x As String
    x = "(Enter)> Cow"
    Dim y
    y = Split(x, " ")
    x = y(UBound(y))
    MsgBox x
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3
    Matthew Gates
    Guest
    You could use the Mid or Right functions as well to subtract words from the right (Left or Mid function to subtract words from the left).


    Code:
    x = "(Enter)> Cow"
    MsgBox Right$(x, 3)
    MsgBox Mid$(x, InStr(x, ">") + 2)

  4. #4
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    And, if your VB version is 6.0 or later, you can use Replace

    TheText = Replace(TheText, "Word-You-Wanna-Remove", "") 'Replace what you don't want with nothing
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width