ASP Concatenate string
am 06.07.2007 02:30:46 von RajuString a=Test
String b=test@test.com
How cn I concatenate this to get
String c ="""Test""
String a=Test
String b=test@test.com
How cn I concatenate this to get
String c ="""Test""
Raju wrote:
> String a=Test
> String b=test@test.com
>
> How cn I concatenate this to get
>
> String c ="""Test""
Since you did not use quotes when defining a and b, I am going to assume you
want c to contain a string whose first 3 characters are quotes, followed by
Test, followed by two quotes, followed by b contained in angle brackets,
followed by a single quote.
Using vbscript you would do this:
dim a,b,c
const quote=""""
a="Test"
b= "test@test.com"
c=quote & quote & quote & a & quote & quote & "<" & _
b & ">" & quote
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Raju wrote on 06 jul 2007 in microsoft.public.inetserver.asp.general:
> String a=Test
> String b=test@test.com
>
> How cn I concatenate this to get
>
> String c ="""Test""
This is one of those instances where,
even while using asp-vbscript in the main code,
I would use a piece of asp-jscript:
<% ' vbscript default
r = concatEmail("Test","test@test.com")
responce.write r
%>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
"Evertjan."
news:Xns996566D0B91F2eejj99@194.109.133.242...
> Raju wrote on 06 jul 2007 in microsoft.public.inetserver.asp.general:
>
> > String a=Test
> > String b=test@test.com
> >
> > How cn I concatenate this to get
> >
> > String c ="""Test""
>
> This is one of those instances where,
> even while using asp-vbscript in the main code,
> I would use a piece of asp-jscript:
>
> <% ' vbscript default
> r = concatEmail("Test","test@test.com")
> responce.write r
> %>
>
>
>
Do you really think launching a different script engine is justifiable in
order to avoid the string """" ?
Anthony Jones wrote on 06 jul 2007 in
microsoft.public.inetserver.asp.general:
>
> "Evertjan."
> news:Xns996566D0B91F2eejj99@194.109.133.242...
>> Raju wrote on 06 jul 2007 in microsoft.public.inetserver.asp.general:
>>
>> > String a=Test
>> > String b=test@test.com
>> >
>> > How cn I concatenate this to get
>> >
>> > String c ="""Test""
>>
>> This is one of those instances where,
>> even while using asp-vbscript in the main code,
>> I would use a piece of asp-jscript:
>>
>> <% ' vbscript default
>> r = concatEmail("Test","test@test.com")
>> responce.write r
>> %>
>>
>>
>>
>
> Do you really think launching a different script engine is justifiable
> in order to avoid the string """" ?
I doubt if it is a "different one", believing it is one and the same,
but in the context of SMTP sending of an email with CDO, JMail, etc,
the possible timing and processor load impact seems unimportant.
Other Jscript functions could be added too.
Using Jscript for quoting [like above] [and things like regex, btw] makes
coding mistakss fare less likely, and comparing that to processing impact
is a personal choice.
For working with serverside UTC, Jscript can even do what VBscript
cannot, like using .getTimezoneOffset()
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
"Evertjan."
news:Xns99659E4184968eejj99@194.109.133.242...
> Anthony Jones wrote on 06 jul 2007 in
> microsoft.public.inetserver.asp.general:
>
> >
> > "Evertjan."
> > news:Xns996566D0B91F2eejj99@194.109.133.242...
> >> Raju wrote on 06 jul 2007 in microsoft.public.inetserver.asp.general:
> >>
> >> > String a=Test
> >> > String b=test@test.com
> >> >
> >> > How cn I concatenate this to get
> >> >
> >> > String c ="""Test""
> >>
> >> This is one of those instances where,
> >> even while using asp-vbscript in the main code,
> >> I would use a piece of asp-jscript:
> >>
> >> <% ' vbscript default
> >> r = concatEmail("Test","test@test.com")
> >> responce.write r
> >> %>
> >>
> >>
> >>
> >
> > Do you really think launching a different script engine is justifiable
> > in order to avoid the string """" ?
>
> I doubt if it is a "different one", believing it is one and the same,
> but in the context of SMTP sending of an email with CDO, JMail, etc,
> the possible timing and processor load impact seems unimportant.
I wouldn't bet on that but you could be right.
> Other Jscript functions could be added too.
>
> Using Jscript for quoting [like above] [and things like regex, btw] makes
> coding mistakss fare less likely,
I don't believe that at all. I can't count the number of times I've left
Then off a If statement cos my head was in JScript mode instead of VBScript.
Coding in both languages is bound to increase the number of mistakes not
reduce them.
> and comparing that to processing impact
> is a personal choice.
>
> For working with serverside UTC, Jscript can even do what VBscript
> cannot, like using .getTimezoneOffset()
What if you turned the tables and did most stuff in JScript, is there
anything in VBScript you'd be prepared to launch the VBScript engine for?
Anthony
Evertjan. wrote:
>> Do you really think launching a different script engine is
>> justifiable in order to avoid the string """" ?
>
> I doubt if it is a "different one", believing it is one and the
> same, but in the context of SMTP sending of an email with CDO,
> JMail, etc, the possible timing and processor load impact seems
> unimportant.
Why do you suppose there are separate DLLs for them if they are the same
engine?
\windows\system32\jscript.dll
\windows\system32\vbscript.dll
--
Dave Anderson
Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Anthony Jones wrote on 06 jul 2007 in
microsoft.public.inetserver.asp.general:
>> I doubt if it is a "different one", believing it is one and the same,
>> but in the context of SMTP sending of an email with CDO, JMail, etc,
>> the possible timing and processor load impact seems unimportant.
>
> I wouldn't bet on that but you could be right.
>
>> Other Jscript functions could be added too.
>>
>> Using Jscript for quoting [like above] [and things like regex, btw]
>> makes coding mistakss fare less likely,
>
> I don't believe that at all. I can't count the number of times I've
> left Then off a If statement cos my head was in JScript mode instead
> of VBScript. Coding in both languages is bound to increase the number
> of mistakes not reduce them.
As I said, I think it is a personal programming choice.
I am used to having some functions in jscript,
while programming in asp-vbs.
>> and comparing that to processing impact
>> is a personal choice.
>>
>> For working with serverside UTC, Jscript can even do what VBscript
>> cannot, like using .getTimezoneOffset()
>
> What if you turned the tables and did most stuff in JScript, is there
> anything in VBScript you'd be prepared to launch the VBScript engine
> for?
Not really.
Most preferences are just habit. There is nothing wrong wih habit.
Having used Basic dialects since the early '80s, VBS comes easily to me,
but using J[ava]cript is like the joyful jump to Pascal [compiler] once
was.
The ease and compactness of Javascript, and the joy of making such
compact code, is like playing chess, where vbscript is an leasurely
scroll though the woods.
However exlusively using vbs serverside and javscript clientside in the
same asp file has it's merits.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Anthony Jones wrote:
> What if you turned the tables and did most stuff in JScript, is
> there anything in VBScript you'd be prepared to launch the
> VBScript engine for?
I'll answer that one. I do all of my ASP in JScript, and I have come up
against two problems that stump me.
The first is the most common -- lack of object documentation. Most examples
are written in VBScript, the vast majority of which utilize default
properties. Unless I can find a reference, those examples are worthless. If
the example uses CreateObject, I can probably work out a way to score an
intellisense hit, but there is no hope if GetObject is used (as virtually
every script in the MS TechNet Script Repository does).
I have considered using VBScript for a couple of LDAP problems I have been
working on recently, but I am leaning more and more toward popping over to
ASP.NET.
The second thing to tempt me into using VBScript was implementing a pure ASP
upload. I spent a few days trying to read the binary data before other
priorities intervened, and when I took it back up, decided on a hybrid
ASP/ASP.NET solution, which was a snap.
So, it appears I resist VBScript at all costs. I was actually baffled by
Evertjan's response myself. JScript is a fine language, but I only advocate
changing languages when a task is simple in one language and nearly
impossible in the other.
--
Dave Anderson
Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Dave Anderson wrote on 06 jul 2007 in
microsoft.public.inetserver.asp.general:
> Evertjan. wrote:
>>> Do you really think launching a different script engine is
>>> justifiable in order to avoid the string """" ?
>>
>> I doubt if it is a "different one", believing it is one and the
>> same, but in the context of SMTP sending of an email with CDO,
>> JMail, etc, the possible timing and processor load impact seems
>> unimportant.
>
> Why do you suppose there are separate DLLs for them if they are the same
> engine?
>
> \windows\system32\jscript.dll
> \windows\system32\vbscript.dll
You tell me.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
dim a,b,c
const quote=""""
a="Test"
b= "t...@test.com"
Response.Write c=quote & quote & quote & a & quote & quote & "<" & _
b & ">" & quote
This will only give Test. It removes the email for some reason.
Raju wrote:
> dim a,b,c
> const quote=""""
> a="Test"
> b= "t...@test.com"
> Response.Write c=quote & quote & quote & a & quote & quote & "<" & _
> b & ">" & quote
>
>
> This will only give Test. It removes the email for some reason.
It doesn't for me ... oh, wait, your code looks different from mine. Try
this:
<%
dim a,b,c
const quote=""""
a="Test"
b= "test@test.com"
c=quote & quote & quote & a & quote & quote & "<" & _
b & ">" & quote
response.write c
%>
I've just tested it and it does what you want
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Raju wrote:
> dim a,b,c
> const quote=""""
> a="Test"
> b= "t...@test.com"
> Response.Write c=quote & quote & quote & a & quote & quote & "<" & _
> b & ">" & quote
>
>
> This will only give Test. It removes the email for some reason.
And, as Anthony pointed out elsewhere, Fiew Source to see the actual
text.
Alternatively, use htmlencode:
Response.Write server.htmlencode(c)
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.