![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Mar 2006
Posts: 8
Rep Power: 0
![]() |
More than one object in a string...
i have multiple objects that i need to be in a string, i don't know much at all about vbscript but this is the type of thing i'm trying to achieve..
if computer = UCASE("comp1") AND ("comp2") then do something... elseif computer =UCASE("comp3") AND ("comp4") then do something... endif is that the correct way i would do it, just simply using an AND?? i've looked round the net but couldn't find anything that helped. |
|
|
|
|
|
#2 |
|
Programmer
Join Date: Oct 2005
Location: India
Posts: 30
Rep Power: 0
![]() |
To check upper case you must check the ascii value of it. I.e checking the ascii value and if it is in between 32 and some number then it will be in upper case. This must be done to all the characters then only the string can be converted to upper case.
Last edited by Uday; Mar 13th, 2006 at 7:24 AM. |
|
|
|
|
|
#3 |
|
Programmer
Join Date: Oct 2005
Location: India
Posts: 30
Rep Power: 0
![]() |
http://www.w3schools.com/vbscript/default.asp
Now i need to learn from the site http://www.w3schools.com/vbscript/tr...e=vbdemo_ucase |
|
|
|
|
|
#4 |
|
Newbie
Join Date: Mar 2006
Posts: 8
Rep Power: 0
![]() |
so my script would work like this???
if computer = "comp1" AND "comp2" Then do something... elseif computer = "comp3" AND "comp4" Then do something... end if ????? |
|
|
|
|
|
#5 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Javascript has "toUpperCase ()" and "toLowerCase ()" methods for strings. They convert entire strings, not just single characters. A germane point here is that when you are provided references, you should attempt to use them. If they turn out to be junk, then you look back here, or elsewhere. This is how the forum is supposed to work: help, not provision of solutions in their entirety.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#6 |
|
Programmer
Join Date: Oct 2005
Location: India
Posts: 30
Rep Power: 0
![]() |
This code is showing Tove
So to use the array one can use dim nameofarray(number of array) <html> <head> </head> <body> <script type="text/vbscript"> dim names(2) names(0)="Tove" names(1)="Jani" names(2)="Stale" document.write(names(0)) </script> </body> </html> |
|
|
|
|
|
#7 | |
|
Programmer
Join Date: Oct 2005
Location: India
Posts: 30
Rep Power: 0
![]() |
Quote:
|
|
|
|
|
|
|
#8 |
|
Newbie
Join Date: Mar 2006
Posts: 8
Rep Power: 0
![]() |
I used that reference before i came here anyway, but people seem to be missing the point, i'm not posting about the UCASE string function i'm posting about using AND in my if statement.
i'm asking if using AND works?? computer = objNet.ComputerName if computer = "computer1" AND "computer2" Then do something... elseif computer = "computer3" AND "computer4" Then do something else... end if so basically, when its executed, it will find the computer name, and if its computer1 or 2 then it will do something... or if the computer name is 3 or 4 it will do something else... i just dont know if and is the correct way to do it??? |
|
|
|
|
|
#9 |
|
Programmer
Join Date: Oct 2005
Location: India
Posts: 30
Rep Power: 0
![]() |
This shows ToveJani
So you can concatenate a string using & <html> <head> </head> <body> <script type="text/vbscript"> dim names(2) names(0)="Tove" names(1)="Jani" names(2)=names(0) & names(1) document.write(names(2)) </script> </body> </html> |
|
|
|
|
|
#10 |
|
Programmer
Join Date: Oct 2005
Location: India
Posts: 30
Rep Power: 0
![]() |
I checked my book and found that and is used in logical conjuction and if you have to concatenate the strings use &
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|