Forum Moderators: open

Message Too Old, No Replies

numbers in strings

what do they do?

         

webboy1

9:58 am on Nov 12, 2002 (gmt 0)

10+ Year Member



Hi,

I have been using ASP a lot recently, and although new to it, i seem to be getting on quite well. However, i keep coming across some things that i just do not know what they are doing.

The latest is numbers within strings. I have seen them a lot, but i am not sure what they are doing.

An example of what i a mtrying to explain would be:

& mid(rtrim(Request("formfield")),1,50) &

I know that this string can be used to insert into a SQL server database the value from "formfeild", and that the "rtrim" is tidying white space (i think). But can anyone tell me what the 1,50 could be for? Why are numbers here? are they default ASP things?

All help appreciated.

Regards
webboy

gsx

10:19 am on Nov 12, 2002 (gmt 0)

10+ Year Member



It's a standard command. Check out where the brackets are: the numbers relate to the mid command.

mid(string,start,length) returns a section of a string, in the case 1,50 - the first 50 characters.

webboy1

10:26 am on Nov 12, 2002 (gmt 0)

10+ Year Member



Cheers gsx.

That makes sense.

webboy

txbakers

12:24 am on Nov 13, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Keep in mind also, that all HTML form elements are strings. Even the ones that look like numbers.

So if you try to do some math on the form.Request elements, you'll have to convert them back to numbers first, just to be safe. Otherwise you run the risk of concatenating the numbers.