Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Cstr WHY?


Message #1 by - <raisy@w...> on Tue, 16 Oct 2001 15:21:59 +0200

Also a question cause I have been looking high and low trying to find an 

answer for this, but am just wondering why using Cstr, from what I read in 

the VBSCRIPT DOCS "CStr to force the result to be expressed as a 

String".........but what does this exactly mean, what is the advantage of this?



thank you for your time :o)



Evan



Message #2 by "Alex Shiell, ITS, EC, SE" <alex.shiell@s...> on Tue, 16 Oct 2001 14:55:54 +0100
if you were to do 



response.write "this is the value: " & i



where i is an integer, it would be implicitly converted to a string in order

to be concatenated onto the string.



however it is good practice to do an explicit conversion, as that would

result in less processing



response.write "this is the value: " & CStr(i)



but don't expect to notice the difference!



something like this is only going to make the minutest bit of difference in

the performance of the ASP.  But, if you're doing this 100 times in an ASP

and its requested by 100 users simultaneously, then you might notice the

difference.



whilst on the subject, it is good practice to avoid too many string

concatenations, so in fact the best way to write the above statement is



response.write "this is the value: " 

response.write CStr(i)



but again, don't expect to be able to notice the difference in performance.



Basically if you have an application that is used by many people and you are

looking to maximise the performance, then these are the types of things you

need to pay attention to.  However, if your priority is to get the

application written quickly, then don't worry about such things.  After all,

the time it takes for a powerful server to process an ASP is minimal

compared to the amount of time a user has to wait for their modem to

download the page.



-----Original Message-----

From: - [mailto:raisy@w...]

Sent: 16 October 2001 14:22

To: ASP Web HowTo

Subject: [asp_web_howto] Cstr WHY?







Also a question cause I have been looking high and low trying to find an 

answer for this, but am just wondering why using Cstr, from what I read in 

the VBSCRIPT DOCS "CStr to force the result to be expressed as a 

String".........but what does this exactly mean, what is the advantage of

this?



thank you for your time :o)



Evan



Message #3 by - <raisy@w...> on Tue, 16 Oct 2001 16:12:31 +0200
Thank you Alex,



That's explained perfectly, thank you very very much!

Gosh you should be a writer (are you a writer?)



Evan



At 02:55 PM 10/16/2001 +0100, you wrote:

>if you were to do

>

>response.write "this is the value: " & i

>

>where i is an integer, it would be implicitly converted to a string in order

>to be concatenated onto the string.

>

>however it is good practice to do an explicit conversion, as that would

>result in less processing

>

>response.write "this is the value: " & CStr(i)

>

>but don't expect to notice the difference!

>

>something like this is only going to make the minutest bit of difference in

>the performance of the ASP.  But, if you're doing this 100 times in an ASP

>and its requested by 100 users simultaneously, then you might notice the

>difference.

>

>whilst on the subject, it is good practice to avoid too many string

>concatenations, so in fact the best way to write the above statement is

>

>response.write "this is the value: "

>response.write CStr(i)

>

>but again, don't expect to be able to notice the difference in performance.

>

>Basically if you have an application that is used by many people and you are

>looking to maximise the performance, then these are the types of things you

>need to pay attention to.  However, if your priority is to get the

>application written quickly, then don't worry about such things.  After all,

>the time it takes for a powerful server to process an ASP is minimal

>compared to the amount of time a user has to wait for their modem to

>download the page.

>

>-----Original Message-----

>From: - [mailto:raisy@w...]

>Sent: 16 October 2001 14:22

>To: ASP Web HowTo

>Subject: [asp_web_howto] Cstr WHY?

>

>

>

>Also a question cause I have been looking high and low trying to find an

>answer for this, but am just wondering why using Cstr, from what I read in

>the VBSCRIPT DOCS "CStr to force the result to be expressed as a

>String".........but what does this exactly mean, what is the advantage of

>this?

>

>thank you for your time :o)

>

>Evan

>

>






Message #4 by "Alex Shiell, ITS, EC, SE" <alex.shiell@s...> on Tue, 16 Oct 2001 15:16:28 +0100
no, just a code monkey ;-)



-----Original Message-----

From: - [mailto:raisy@w...]

Sent: 16 October 2001 15:13

To: ASP Web HowTo

Subject: [asp_web_howto] RE: Cstr WHY?





Thank you Alex,



That's explained perfectly, thank you very very much!

Gosh you should be a writer (are you a writer?)



Evan



At 02:55 PM 10/16/2001 +0100, you wrote:

>if you were to do

>

>response.write "this is the value: " & i

>

>where i is an integer, it would be implicitly converted to a string in

order

>to be concatenated onto the string.

>

>however it is good practice to do an explicit conversion, as that would

>result in less processing

>

>response.write "this is the value: " & CStr(i)

>

>but don't expect to notice the difference!

>

>something like this is only going to make the minutest bit of difference in

>the performance of the ASP.  But, if you're doing this 100 times in an ASP

>and its requested by 100 users simultaneously, then you might notice the

>difference.

>

>whilst on the subject, it is good practice to avoid too many string

>concatenations, so in fact the best way to write the above statement is

>

>response.write "this is the value: "

>response.write CStr(i)

>

>but again, don't expect to be able to notice the difference in performance.

>

>Basically if you have an application that is used by many people and you

are

>looking to maximise the performance, then these are the types of things you

>need to pay attention to.  However, if your priority is to get the

>application written quickly, then don't worry about such things.  After

all,

>the time it takes for a powerful server to process an ASP is minimal

>compared to the amount of time a user has to wait for their modem to

>download the page.

>

>-----Original Message-----

>From: - [mailto:raisy@w...]

>Sent: 16 October 2001 14:22

>To: ASP Web HowTo

>Subject: [asp_web_howto] Cstr WHY?

>

>

>

>Also a question cause I have been looking high and low trying to find an

>answer for this, but am just wondering why using Cstr, from what I read in

>the VBSCRIPT DOCS "CStr to force the result to be expressed as a

>String".........but what does this exactly mean, what is the advantage of

>this?

>

>thank you for your time :o)

>

>Evan

>

>

  Return to Index