By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,166 Members | 1,130 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,166 IT Pros & Developers. It's quick & easy.

remove space in front of string

P: n/a
I'm getting string returned from my Database with a space in front of it, it sometimes it looks like this

8
9
10
1
and so one, how can I remove the white space in front of the numbers? Its actually causing an error on one of my pages and I'm not sure how to remove it in the beginning of the string.
Aug 13 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
I figured it out, Trim() worked for the front white space in front of the string as well. DOH
"Steve" <St***@community.nospam.comwrote in message news:eu****************@TK2MSFTNGP04.phx.gbl...
I'm getting string returned from my Database with a space in front of it, it sometimes it looks like this

8
9
10
1
and so one, how can I remove the white space in front of the numbers? Its actually causing an error on one of my pages and I'm not sure how to remove it in the beginning of the string.
Aug 13 '07 #2

P: n/a
Are you trying to change it in the database, or just fix it on the pages?

David Wier
http://aspnet101.com
http://iWritePro.com
"Steve" <St***@community.nospam.comwrote in message news:eu****************@TK2MSFTNGP04.phx.gbl...
I'm getting string returned from my Database with a space in front of it, it sometimes it looks like this

8
9
10
1
and so one, how can I remove the white space in front of the numbers? Its actually causing an error on one of my pages and I'm not sure how to remove it in the beginning of the string.
Aug 13 '07 #3

P: n/a
on the pages only. Its be returned from the database correctly but for some reason the code added a space in front of the value is there is more then one. The values are coming through fine until the code hits a For each loop

I got it working though.
"David Wier" <da*******@davidwier.nospam.comwrote in message news:%2****************@TK2MSFTNGP03.phx.gbl...
Are you trying to change it in the database, or just fix it on the pages?

David Wier
http://aspnet101.com
http://iWritePro.com
"Steve" <St***@community.nospam.comwrote in message news:eu****************@TK2MSFTNGP04.phx.gbl...
I'm getting string returned from my Database with a space in front of it, it sometimes it looks like this

8
9
10
1
and so one, how can I remove the white space in front of the numbers? Its actually causing an error on one of my pages and I'm not sure how to remove it in the beginning of the string.
Aug 13 '07 #4

P: n/a
Steve wrote:
on the pages only. Its be returned from the database correctly but for
some reason the code added a space in front of the value is there is
more then one. The values are coming through fine until the code hits a
For each loop

I got it working though.
It sounds like you are trying to fix a problem by only correcting the
sympthomes that you have observed. Extra spaces doesn't appear from
nowhere, there is a reason for it. You really should consider to
investigate a bit further what's really happening.

It's adding spaces right now, but it might just as well add other
characters that a Trim can't handle. Suddenly your "10" might turn into
"910" or ".10"...

--
Göran Andersson
_____
http://www.guffa.com
Aug 13 '07 #5

P: n/a
We put a change in the stored procedure as well.
"Göran Andersson" <gu***@guffa.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Steve wrote:
>on the pages only. Its be returned from the database correctly but for
some reason the code added a space in front of the value is there is more
then one. The values are coming through fine until the code hits a For
each loop
I got it working though.

It sounds like you are trying to fix a problem by only correcting the
sympthomes that you have observed. Extra spaces doesn't appear from
nowhere, there is a reason for it. You really should consider to
investigate a bit further what's really happening.

It's adding spaces right now, but it might just as well add other
characters that a Trim can't handle. Suddenly your "10" might turn into
"910" or ".10"...

--
Göran Andersson
_____
http://www.guffa.com

Aug 13 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.