|
|
|
start date: Mon, 13 Aug 2007 12:06:57 -0400,
posted on: microsoft.public.dotnet.framework.aspnet
back
| Thread Index |
|
1
Steve
|
|
2
Steve
|
|
3
David Wier
|
|
4
Steve
|
|
5
Göran Andersson
|
|
6
Steve
|
remove space in front of string
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.
Date:Mon, 13 Aug 2007 12:06:57 -0400
Author:
|
Re: remove space in front of string
I figured it out, Trim() worked for the front white space in front of the string as well. DOH
"Steve" wrote in message news:eu7O%23Pc3HHA.1824@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.
Date:Mon, 13 Aug 2007 12:16:32 -0400
Author:
|
Re: remove space in front of string
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" wrote in message news:eu7O%23Pc3HHA.1824@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.
Date:Mon, 13 Aug 2007 11:18:46 -0500
Author:
|
Re: remove space in front of string
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" wrote in message news:%235nzeWc3HHA.1204@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" wrote in message news:eu7O%23Pc3HHA.1824@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.
Date:Mon, 13 Aug 2007 13:06:58 -0400
Author:
|
Re: remove space in front of string
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"...
--
Gran Andersson
_____
http://www.guffa.com
Date:Mon, 13 Aug 2007 20:22:50 +0200
Author:
|
Re: remove space in front of string
We put a change in the stored procedure as well.
"Gran Andersson" wrote in message
news:%23ucy6bd3HHA.2064@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"...
>
> --
> Gran Andersson
> _____
> http://www.guffa.com
Date:Mon, 13 Aug 2007 14:29:42 -0400
Author:
|
|
|