Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 13th, 2006, 3:46 AM   #1
forcerr
Newbie
 
Join Date: Mar 2006
Posts: 8
Rep Power: 0 forcerr is on a distinguished road
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.
forcerr is offline   Reply With Quote
Old Mar 13th, 2006, 7:03 AM   #2
Uday
Programmer
 
Join Date: Oct 2005
Location: India
Posts: 30
Rep Power: 0 Uday is on a distinguished road
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.
Uday is offline   Reply With Quote
Old Mar 13th, 2006, 7:39 AM   #3
Uday
Programmer
 
Join Date: Oct 2005
Location: India
Posts: 30
Rep Power: 0 Uday is on a distinguished road
http://www.w3schools.com/vbscript/default.asp

Now i need to learn from the site

http://www.w3schools.com/vbscript/tr...e=vbdemo_ucase
Uday is offline   Reply With Quote
Old Mar 13th, 2006, 7:48 AM   #4
forcerr
Newbie
 
Join Date: Mar 2006
Posts: 8
Rep Power: 0 forcerr is on a distinguished road
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

?????
forcerr is offline   Reply With Quote
Old Mar 13th, 2006, 8:03 AM   #5
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old Mar 13th, 2006, 8:10 AM   #6
Uday
Programmer
 
Join Date: Oct 2005
Location: India
Posts: 30
Rep Power: 0 Uday is on a distinguished road
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>
Uday is offline   Reply With Quote
Old Mar 13th, 2006, 8:14 AM   #7
Uday
Programmer
 
Join Date: Oct 2005
Location: India
Posts: 30
Rep Power: 0 Uday is on a distinguished road
Quote:
They convert entire strings, not just single characters
very true
Uday is offline   Reply With Quote
Old Mar 13th, 2006, 8:16 AM   #8
forcerr
Newbie
 
Join Date: Mar 2006
Posts: 8
Rep Power: 0 forcerr is on a distinguished road
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???
forcerr is offline   Reply With Quote
Old Mar 13th, 2006, 8:21 AM   #9
Uday
Programmer
 
Join Date: Oct 2005
Location: India
Posts: 30
Rep Power: 0 Uday is on a distinguished road
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>
Uday is offline   Reply With Quote
Old Mar 13th, 2006, 8:29 AM   #10
Uday
Programmer
 
Join Date: Oct 2005
Location: India
Posts: 30
Rep Power: 0 Uday is on a distinguished road
I checked my book and found that and is used in logical conjuction and if you have to concatenate the strings use &
Uday is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:19 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC