Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: deleting spaces between text


Message #1 by jon.holyoake@m... on Wed, 7 Jun 2000 10:32:7
hi i need to check postcodes in my database to see if they are already 

their ....



my problem is how do i for example change the postcode  -  sy1 2du with a 

space to  - sy12du  with the space removed



can i do this using VB script???

Message #2 by "Robert Larsson" <robert.l@m...> on Wed, 7 Jun 2000 12:15:11 -0700
Dim postcode

postcode = "sy 1 2du"

postcode = Replace(postcode, " ", "")



The last line replaces all spaces with nothing, so the spaces will be

removed.





Mvh,

Robert Larsson!

Web-production Coordinator

---------------------------------------------------------------------

Mindflow AB | www.mindflow.se | 08-545 635 10





----- Original Message -----

From: jon.holyoake

To: "ASP Databases" <asp_databases@p...>

Sent: Wednesday, June 07, 2000 10:00 AM

Subject: [asp_databases] deleting spaces between text





> hi i need to check postcodes in my database to see if they are already

> their ....

>

> my problem is how do i for example change the postcode  -  sy1 2du with a

> space to  - sy12du  with the space removed

>

> can i do this using VB script???

>
Message #3 by "Ken Schaefer" <ken.s@a...> on Wed, 7 Jun 2000 20:32:59 +1000
Use the Replace() function.



Never heard of Replace()? Don't know how it works? Download the VBScript

documentation from:



http://msdn.microsoft.com/scripting/vbscript/download/vbsdoc.exe



Cheers

Ken



----- Original Message -----

From: jon.holyoake

To: "ASP Databases" <asp_databases@p...>

Sent: Wednesday, June 07, 2000 10:00 AM

Subject: [asp_databases] deleting spaces between text





> hi i need to check postcodes in my database to see if they are already

> their ....

>

> my problem is how do i for example change the postcode  -  sy1 2du with a

> space to  - sy12du  with the space removed

>

> can i do this using VB script???





Message #4 by "Ruud Voigt" <RuudVoigt@w...> on Wed, 7 Jun 2000 16:24:06 +0200
Sure,

one way to do it would be to

'split' the string at the " "

and then add them together again:



var1 = "sy1 2du"

var2 = var1.split(" ")

var3 = ""

for each item in var2

var3 = var3 + item

next



you should check the syntax of the

split function to see if I rememberd

it correctly, but the principle is

sound. after this var3 should contain

"sy12du"



You could also try it with an empty

replace in a regular expression.



There are really a lot of different ways

to do this, it depends on what methods

you're conforable with, the split method

is probably the simplest soluton.







-----Original Message-----

From: jon.holyoake

[mailto:jon.holyoake@m...]

Sent: Wednesday, June 07, 2000 10:00 AM

To: ASP Databases

Subject: [asp_databases] deleting spaces between text





hi i need to check postcodes in my database to see if they are already

their ....



my problem is how do i for example change the postcode  -  sy1 2du with a

space to  - sy12du  with the space removed



can i do this using VB script???

Message #5 by "Robert Larsson" <robert.l@m...> on Wed, 7 Jun 2000 19:38:15 -0700
Why complicate it why You can do it in one line :)



var = Replace(var, " ", "")



----- Original Message -----

From: "Ruud Voigt" 

To: "ASP Databases" <asp_databases@p...>

Sent: Wednesday, June 07, 2000 7:24 AM

Subject: [asp_databases] RE: deleting spaces between text





> Sure,

> one way to do it would be to

> 'split' the string at the " "

> and then add them together again:

>

> var1 = "sy1 2du"

> var2 = var1.split(" ")

> var3 = ""

> for each item in var2

> var3 = var3 + item

> next

>

> you should check the syntax of the

> split function to see if I rememberd

> it correctly, but the principle is

> sound. after this var3 should contain

> "sy12du"

>

> You could also try it with an empty

> replace in a regular expression.

>

> There are really a lot of different ways

> to do this, it depends on what methods

> you're conforable with, the split method

> is probably the simplest soluton.

>

>

>

> -----Original Message-----

> From: jon.holyoake

> [mailto:jon.holyoake@m...]

> Sent: Wednesday, June 07, 2000 10:00 AM

> To: ASP Databases

> Subject: [asp_databases] deleting spaces between text

>

>

> hi i need to check postcodes in my database to see if they are already

> their ....

>

> my problem is how do i for example change the postcode  -  sy1 2du with a

> space to  - sy12du  with the space removed

>

> can i do this using VB script???

>

  Return to Index