Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / August 2007

Tip: Looking for answers? Try searching our database.

remove space in front of string

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve - 13 Aug 2007 17:06 GMT
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.
Steve - 13 Aug 2007 17:16 GMT
I figured it out, Trim() worked for the front white space in front of the string as well. DOH
 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.
David Wier - 13 Aug 2007 17:18 GMT
Are you trying to change it in the database, or just fix it on the pages?

David Wier
http://aspnet101.com
http://iWritePro.com
 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.
Steve - 13 Aug 2007 18:06 GMT
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.
 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" <Steve@community.nospam.com> 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.
Göran Andersson - 13 Aug 2007 19:22 GMT
> 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"...

Signature

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

Steve - 13 Aug 2007 19:29 GMT
We put a change in the stored procedure as well.

>> 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
[quoted text clipped - 10 lines]
> characters that a Trim can't handle. Suddenly your "10" might turn into
> "910" or ".10"...

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.