Help - Search - Members - Calendar
Full Version: ASP alternative to .= for adding to a var
Invision Power Services > Community Forums > Community Web Design and Coding
Jeremy-
In PHP, you can use .= to add to a variable, for example:

CODE
$test = "this is a ";

$test .= "test";


That would result in $test being "this is a test"


How can I do something similar in ASP?
Rikki
You can't, as far as I know. I couldn't find anything that did that when I was writing ASP anyway. (I was writing ASP, not ASP.net)
Chad
As far as I know, if ASP handles vars the same. You could do:

CODE
$test = "this is a ";
$test = $test."test";


I cannot honestly tell you if that would work or not. Worth a shot. original.gif

Chad
Stephen
Depends on which scripting language you are using, VBScript or JavaScript.

In VBScript you use

CODE
var = var & "new value"

and in JavaScript you use

CODE
var = var + "new value"


If you don't know which you are using it will most likely be VBScript.

People seem to forget, ASP isn't a language its a framework so when trying to find out how to do some sort of basic language operation like that you need to look for the "VBScript string concatination" not "ASP string concatination".
Rikki
QUOTE(Stephen @ May 11 2005, 09:20 PM) *
Depends on which scripting language you are using, VBScript or JavaScript.

In VBScript you use
CODE
var = var & "new value"
and in JavaScript you use
CODE
var = var + "new value"


If you don't know which you are using it will most likely be VBScript.

People seem to forget, ASP isn't a language its a framework so when trying to find out how to do some sort of basic language operation like that you need to look for the "VBScript string concatination" not "ASP string concatination".


Yeah but doing var = var & "blah" is different to var .= "blah". I think he wants the shorthand way (which I don't think exists in either scripting language).
Stephen
it doesn't, but it does the same thing. Well in JS you can do var += var but some times it doesn't work correctly due to integers in the string
Brendon Koz
I'm curious to know if he's using ASP or ASP.NET...

I like C#. biggrin.gif
Stephen
Well the title says ASP wink.gif
Brendon Koz
...the smiley's tongue doesn't stick out far enough for me to show my actual dismay at seeing that. ...meanie.

wink.gif
Stephen
laughing.gif
.Jack
Man,,,, I haven't used ASP for a while.... *brushes dust of IIS installation* laughing.gif
Jeremy-
I figured it out, it's something like

string = string _
& "whatever" _
& "whatever2"

If I can remember, I'll post the code when I'm at work tomorrow. And for those wondering, this was for just plain 'ole ASP. Running on Windows 2000. Yes... 2000, not 2003. It's pretty sad. sad.gif
sbauer
QUOTE(Jeremy- @ May 12 2005, 09:07 PM) *
I figured it out, it's something like

string = string _
& "whatever" _
& "whatever2"

If I can remember, I'll post the code when I'm at work tomorrow. And for those wondering, this was for just plain 'ole ASP. Running on Windows 2000. Yes... 2000, not 2003. It's pretty sad. sad.gif

Yeah, it's a pain, but that's really all you can do.
ranbo
QUOTE(Jeremy- @ May 13 2005, 09:07 AM) *
I figured it out, it's something like

string = string _
& "whatever" _
& "whatever2"

If I can remember, I'll post the code when I'm at work tomorrow. And for those wondering, this was for just plain 'ole ASP. Running on Windows 2000. Yes... 2000, not 2003. It's pretty sad. sad.gif


I haven't used ASP for a while.
The proble occurred to me before.I finally solved the problem.Set the IIS6.0 as IIS5.0 is ok on 2003.
sbauer
QUOTE(ranbo @ May 14 2005, 12:06 AM) *
I haven't used ASP for a while.
The proble occurred to me before.I finally solved the problem.Set the IIS6.0 as IIS5.0 is ok on 2003.

You shouldn't have to do that in order to get it to work. Reverting back to IIS 5.0 isolation mode destroys quite a bit of new features including within 6.0.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.