Results 1 to 23 of 23

Thread: 0<>9 or 0<9 or something else

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    this is what I have:

    Code:
    intnumber = 'what????
    if text1.text = "dimava" & intnumber then
    end
    end if
    I dont know what to write to make sure that the number is 0 to 9
    NXSupport - Your one-stop source for computer help

  2. #2
    Hyperactive Member
    Join Date
    May 2000
    Location
    Or
    Posts
    316
    I believe you could just use, the IsNumeric function, if you just need to make sure it is a number

    Code:
    'Looking for just 0-9, make sure the variable is just one 
    'character
    Dim intnumber as long *1
      If IsNumeric(intnumber)=true then
         Do something
      Else
         Don't do something
      end if
    Hope this helps.

  3. #3
    Guest
    Try this.

    Code:
    'Since the length of "Dimava" is 6 we get the length of Text1 and subtract 6.
    Num = Right(Text1, Len(Text1) - 6)
    If Val(Num) >= 0 And Val(Num) <= 9 Then
        'It's between 0 and 9
        End
    End If

    [Edited by Megatron on 07-28-2000 at 05:07 PM]

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

    <?>

    Dim x As String
    x = Right(Text1, 4)

    If Asc(x) < 80 Or Asc(x) > 89 Then
    MsgBox "no number"
    End If
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  5. #5
    PowerPoster eiSecure's Avatar
    Join Date
    Jul 2000
    Location
    Texas
    Posts
    2,209
    You can also use a MaskedEdit box.

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    thanks to all now what if I want to have it:

    Code:
    if text1.text = "dimava" & LOWER CASE LETTER then
    end
    end if
    ans also:
    [code]
    if text1.text = "dimava" & UPER CASE LETTER then
    end
    end if
    [/code[
    NXSupport - Your one-stop source for computer help

  7. #7
    Guest
    Try this.

    Code:
    Char = Mid(Text1, 7, 1)
    If Asc(Char) > 96 And Asc(Char) < 123 Then
        'Letter is Lower Case
    ElseIf Asc(Char) > 64 And Asc(Char) < 91 Then
        'Letter is Upper Case
    End If

  8. #8

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    thanks MegaTron
    NXSupport - Your one-stop source for computer help

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    but whats the code for

    if text1.text = "dimava" & LOWER CASE LETTER then
    end
    end if

    what doI put in the lower case thing

    do I need to refer to the other code that you gave me or do I just put it there?

    (question is directed to megatron)
    NXSupport - Your one-stop source for computer help

  10. #10
    Guest
    Sorry about that. Try it now.

    Code:
    If Left(Text1, 6) = "dimava" Then
        Char = Mid(Text1, 7, 1)
        If Asc(Char) > 96 And Asc(Char) < 123 Then
            'Letter is Lower Case
        ElseIf Asc(Char) > 64 And Asc(Char) < 91 Then
            'Letter is Upper Case
        End If
    End If

  11. #11

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    thanks
    NXSupport - Your one-stop source for computer help

  12. #12

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    1 more question:

    you have a bunch of numbers there, can you please tell me what it means, because I'm planning to use it in other programs too... and with other words and stuff

    or if the numbers dont have anything to do with the text then please tell me
    NXSupport - Your one-stop source for computer help

  13. #13

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    also... I want it to be like "dimava" & your uper case code & "a" & lower case code then
    ..........................
    NXSupport - Your one-stop source for computer help

  14. #14
    Guest
    Try this.

    Code:
    'If the first 6 characters of the string is dimava then
    If Left(Text1, 6) = "dimava" Then
        
        'Capture the 7th character
        Char = Mid(Text1, 7, 1)
        'Check if it's UpperCase
        If Asc(Char) > 64 And Asc(Char) < 91 Then
            'Letter is UpperCase
        End If
        
        'Capture the 8th character
        Char = Mid(Text1, 8, 1)
        'Check if it's LowerCase
        If Asc(Char) > 96 And Asc(Char) < 123 Then
            'Letter is LowerCase
        End If
        
    End If
    The number's are representing the ASCII values for the characters. If it's greater than 64 (A = 65) and less than 91 (Z = 90) then it's uppercase. If it's grater than 96 (a = 97) and less than 123 (z = 123) then it's lowercase.

  15. #15

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    This is what I need:


    the first letter to be uppercase
    the second letter to be #
    the third to be a "a"
    the forth to be a lower case
    and
    the fifth to be a 1

    can you please give me the code for it

    thanks
    NXSupport - Your one-stop source for computer help

  16. #16
    Guest
    Sure. It's just a matter of putting things together.

    Code:
    If Left(Text1, 6) = "dimava" Then
        
        'Capture the 7th character
        Char = Mid(Text1, 7, 1)
        'Check if it's UpperCase
        If Asc(Char) > 64 And Asc(Char) < 91 Then
            'Letter is UpperCase
        End If
        
        'Capture the 8th character
        Char = Mid(Text1, 8, 1)
        'Check if it's a Number
        If Asc(Char) > 47 And Asc(Char) < 58 Then
            'Character is a Number
        End If
        
        'Capture the 8th character
        Char = Mid(Text1, 9, 1)
        'Check if it's LowerCase
        If Asc(Char) > 96 And Asc(Char) < 123 Then
            'Letter is LowerCase
        End If
        
        'Capture the 8th character
        Char = Mid(Text1, 10, 1)
        'Check if it's a 1
        If Char = "1" Then
            'Character is a One
        End If
        
    End If
    [Edited by Megatron on 07-28-2000 at 06:45 PM]

  17. #17

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    This is what I need:


    the first letter to be uppercase
    the second letter to be #
    the third to be a "a"
    the forth to be a lower case
    and
    the fifth to be a 1

    can you please give me the code for it


    What I ment wasthere is no Dimava in the string, and I need the first lettter of the string to be upercase

    Do just put1? or I'm not sure please respond
    thanks
    NXSupport - Your one-stop source for computer help

  18. #18
    Guest
    Try it now.

    Code:
    'Capture the 1st character
    Char = Mid(Text1, 1, 1)
    'Check if it's UpperCase
    If Asc(Char) > 64 And Asc(Char) < 91 Then
        'Letter is UpperCase
    End If
    
    'Capture the 2nd character
    Char = Mid(Text1, 2, 1)
    'Check if it's a Number
    If Asc(Char) > 47 And Asc(Char) < 58 Then
        'Character is a Number
    End If
    
    'Capture the 3rd character
    Char = Mid(Text1, 4, 1)
    'Check if it's an "a"
    If Char = "a" Then
        'Character is "a"
    End If
    
    'Capture the 4th character
    Char = Mid(Text1, 3, 1)
    'Check if it's LowerCase
    If Asc(Char) > 96 And Asc(Char) < 123 Then
        'Letter is LowerCase
    End If
    
    'Capture the 5th character
    Char = Mid(Text1, 4, 1)
    'Check if it's a 1
    If Char = "1" Then
        'Character is a One
    End If

  19. #19

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    thanks megatron, also thanks for taking so long to respond I decided to look at it and see how it works, I got everything to work before your last post, thanks for teaching me


    dimava
    NXSupport - Your one-stop source for computer help

  20. #20
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Fast and easy solution for you dimiva

    LIKE, learn to love it
    Code:
    IF text1 Like "[A-Z]#a[a-z]1" then
       'Letter is what you want
    End if
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  21. #21

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    thanks, but I already did the whole thing using megatrons mega solution
    NXSupport - Your one-stop source for computer help

  22. #22
    Guest
    Hey Kedaman, could you explain that just a little. I am somewhat understanding it, or maybe give me a keyword to search in the MSDN help files...anything so I can learn that. It looks almost just like a database query?.?.

  23. #23
    Guest
    Basically it's used to comapre 2 strings. Look up Like Operator for futher information.

    [A-Z] means the character can be A, B, C... all the way to Z (Uppercase)
    # means a numeric character
    [a-z] means the character can be a, b, c... all the way to z. (Lowercase)
    a and 1 simply mean the character's a and 1.



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