ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old September 23rd, 2003, 07:17 PM
jax jax is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 7 jax User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
removing white space?!?!

Hi,
I am fairly new to ASP.
I have made a feedback form script.
BUT am having troubles removing whitespace from between names for emailing.
The address is a variable.
It works fine for addresses with one word.
Having troubles and losing hair fast!
thanks for your help in advance,
cheerio
Jax

Reply With Quote
  #2  
Old September 23rd, 2003, 11:38 PM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 788 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 8
Can you post an example of what you are trying to do exactly?
__________________
__________________________________________________ _
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
Are You Listed...? | DigitallySmooth Inc.

Reply With Quote
  #3  
Old September 23rd, 2003, 11:47 PM
jax jax is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 7 jax User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thankyou for your response!
I have just worked it out myself
Was looking for something like this...

Do While InStr(1, GymAddress, " ")
GymAddress = Replace(GymAddress, " ", "")
Loop

had names of gym from database but names had spaces...
email addresses mailed to string var "GymAddress" are same as gym names without the spaces...

thanks anyway - perhaps this can help someone else.
Regs,
Jax

Reply With Quote
  #4  
Old September 24th, 2003, 12:03 AM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 788 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 8
If you were looking to get rid of all spaces then this would have been better:

Code:
    Dim withSpaces, noSpaces As String
    withSpaces = "this is some text with spaces"
    noSpaces = Replace(withSpaces, " ", "", 1, -1, 1)

Reply With Quote
  #5  
Old September 24th, 2003, 12:03 AM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 788 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 8
Of Course the key piece is:

Replace(withSpaces, " ", "", 1, -1, 1)

without having to loop.

Reply With Quote
  #6  
Old September 24th, 2003, 12:15 AM
jax jax is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 7 jax User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs up

In this case I need to trim white space usually 1 between words.
I also need to change street to st if it appears.
This code below works:

Do While InStr(1, GymAddress, " ")
GymAddress = Replace(GymAddress, " ", "")
Loop

Do While InStr(1, GymAddress, "street")
GymAddress = Replace(GymAddress, "street", "st")
Loop


you have suggested this alternative:

Replace(withSpaces, " ", "", 1, -1, 1)

could u please explain how this function works?!?

ALSO
can you point me to any good sites for this kind of information, or recommend any books.
I have some experience with PHP and VB6.0.
Thanks for your help!!!
Jax

Reply With Quote
  #7  
Old September 24th, 2003, 12:58 AM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 788 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 8
http://msdn.microsoft.com/library/d...sfctreplace.asp

Quote:
Replace Function
Returns a string in which a specified substring has been replaced with another substring a specified number of times.

Replace(expression, find, replacewith[, start[, count[, compare]]])

So essentially, this function if used with -1 in the count parameter will replace ALL occurances of the "find" parameter.

Reply With Quote
  #8  
Old September 24th, 2003, 05:52 AM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 44 m 22 sec
Reputation Power: 0
Using the function like
Code:
Replace(withSpaces, " ", "")
will, in this case, yield the same results.

Reply With Quote
  #9  
Old September 24th, 2003, 12:06 PM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 788 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 8
Quote:
Replace(withSpaces, " ", "")
Very true, although I've always found it to be better practice to enter all the parameters.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > removing white space?!?!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

Request Your Free Technology Downloads!
 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

Request Your Free Technology Downloads!
 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

Request Your Free Technology Downloads!
 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

Request Your Free Technology Downloads!
 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek