Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Other Development Tools
 Trim(Request.Form("txtFromName"))

Author  Topic 

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2005-06-01 : 08:56:50
hello,
Am wondering if its ok to use just
Trim(Request.Form("txtFromName"))


or to use both
rTrim(ltrim(Request.Form("txtFromName")))

?

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-06-01 : 09:08:05
Both are same. Use trim

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-06-01 : 09:11:19
don't ask. Test.

dim s as string
s = " test "
response.write "X" & Trim(s) & "X<BR>"
response.write "X" & LTrim(RTrim(s)) & "X<BR>"


Is it really easier to come to a forum and post a question and wait for the response then it is to write a couple lines of code to see for yourself? :)

Learning how to write concise and thorough snippets of code to test algorithms or functions you haven't used yet is one of the most imporant skills a good programmer can have. You'll learn a lot more that way rather than asking someone else to do it for you ....

- Jeff
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2005-06-01 : 11:29:32
quote:
Originally posted by jsmith8858

Is it really easier to come to a forum and post a question and wait for the response then it is to write a couple lines of code to see for yourself? :)


Ok Jeff

however your script below gives an error. its vb script
dim s
not dim s as string
dim s as string
s = " test "
response.write "X" & Trim(s) & "X<BR>"
response.write "X" & LTrim(RTrim(s)) & "X<BR>"

quote:
Originally posted by madhivanan

quote:
Both are same. Use trim[/quote]

I had used both for different senarios, was just wondering why you still get to see both ltrim and rtrim being used together

thanks
Afrika

Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-06-01 : 11:35:42
Thanks for the VBScript tip ! I should have proof read it and tested it thoroughly before carelessly posting sample code for you ...

- Jeff
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2005-06-01 : 12:05:04
Guess that works well with vb6.0

i had tested it also here
http://www.w3schools.com/asp/showasp.asp?filename=demo_asp_trim
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-06-01 : 13:34:01
Hopefully you are understanding that the point is not to use the code I've provided and cut and paste and hope that it answers your question. That is not my intention. I am trying to show you how easy it is to find out these things for yourself, to teach you better habits instead of coming here or elswhere every time you are not sure of something, especially things that are extremely trivial and take 2 minutes to test.


- Jeff
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2005-06-01 : 13:52:43
Thanks a lot Jeff for the advice.

I always like to ask questions about everything, even though it may seem trival. Nothing wrong being inquisitive, it helps especially when positive.

Thats how i got into computing, simply being inquisitive, apart from the innate knack i have for computing and creativity. also learning from the gurus has been a big help.

I was surprised when i asked what type of datatype to use for phone numbers and it turned out to be a hot topic, something as trival and simple as that.

Afrika
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-06-02 : 14:36:42
Nothing wrong with getting some positive assurance before crashing your system afrika :).



Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2005-06-02 : 16:02:35
thanks a mill jhermiz
would consult you when i need disaster recovery

:-)
Go to Top of Page
   

- Advertisement -