|
-
Jul 28th, 2000, 03:57 PM
#1
Thread Starter
Frenzied Member
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
-
Jul 28th, 2000, 04:02 PM
#2
Hyperactive Member
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.
-
Jul 28th, 2000, 04:04 PM
#3
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]
-
Jul 28th, 2000, 04:06 PM
#4
_______
<?>
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
-
Jul 28th, 2000, 04:09 PM
#5
PowerPoster
You can also use a MaskedEdit box.
-
Jul 28th, 2000, 04:09 PM
#6
Thread Starter
Frenzied Member
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
-
Jul 28th, 2000, 04:45 PM
#7
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
-
Jul 28th, 2000, 04:48 PM
#8
Thread Starter
Frenzied Member
NXSupport - Your one-stop source for computer help
-
Jul 28th, 2000, 04:53 PM
#9
Thread Starter
Frenzied Member
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
-
Jul 28th, 2000, 04:59 PM
#10
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
-
Jul 28th, 2000, 05:00 PM
#11
Thread Starter
Frenzied Member
NXSupport - Your one-stop source for computer help
-
Jul 28th, 2000, 05:07 PM
#12
Thread Starter
Frenzied Member
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
-
Jul 28th, 2000, 05:14 PM
#13
Thread Starter
Frenzied Member
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
-
Jul 28th, 2000, 05:22 PM
#14
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.
-
Jul 28th, 2000, 05:34 PM
#15
Thread Starter
Frenzied Member
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
-
Jul 28th, 2000, 05:43 PM
#16
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]
-
Jul 28th, 2000, 05:56 PM
#17
Thread Starter
Frenzied Member
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
-
Jul 28th, 2000, 07:07 PM
#18
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
-
Jul 28th, 2000, 07:10 PM
#19
Thread Starter
Frenzied Member
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
-
Jul 28th, 2000, 11:45 PM
#20
transcendental analytic
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.
-
Jul 29th, 2000, 10:17 AM
#21
Thread Starter
Frenzied Member
thanks, but I already did the whole thing using megatrons mega solution
NXSupport - Your one-stop source for computer help
-
Jul 29th, 2000, 01:54 PM
#22
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?.?.
-
Jul 29th, 2000, 02:26 PM
#23
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|