Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 checking & changing a string
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Jezmeister
Senior Member

United Kingdom
1141 Posts

Posted - 11 February 2008 :  15:40:28  Show Profile  Visit Jezmeister's Homepage
hola, been a while since i last poked my head in lol anyway I'm extending my site a bit more and my latest addition is having to run PHP (it has to be on a linux server for a few reasons) and as I'm far too lazy, err, i mean, I don't have the time to learn php I'm getting away with most things by doing them through my main site in ASP, the problem is I need all my members usernames when they setup the extended bit of their accounts set to lower case and with any spaces removed. I would just ask members to do it but as I want to keep logins the same it would be nice if it could be done automatically.
So essentially all I'm trying to do is: convert a string to lowercase and remove any spaces.

If I had the time/energy I'd figure it out myself but I'd really appreciate any help as my brain is frying (gave up drinking a month ago, haven't slept since lol). I'm pretty sure it can be done with regular expressions, that's how I'd approach it anyway.

thanks :)

edit: call the string strX if you must lol it really doesn't matter, all I need is the barebones if possible as it needs to be implemented in a few different places anyway

Edited by - Jezmeister on 11 February 2008 15:41:22

muzishun
Senior Member

United States
1079 Posts

Posted - 11 February 2008 :  15:53:43  Show Profile  Visit muzishun's Homepage
You want:

$strX = strtolower(str_replace(" ", "", $strX)

Bill Parrott
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)
Go to Top of Page

AnonJr
Moderator

United States
5768 Posts

Posted - 11 February 2008 :  15:59:40  Show Profile  Visit AnonJr's Homepage
I thought he wanted an ASP/VBScript solution

It would be similar though:
strX = LCase(Replace(strX," ",""))


Edit: You could do it with a RegEx too, but (IMHO) its a little more work than its worth for something so simple.

Edited by - AnonJr on 11 February 2008 16:00:32
Go to Top of Page

muzishun
Senior Member

United States
1079 Posts

Posted - 11 February 2008 :  16:10:10  Show Profile  Visit muzishun's Homepage
Well, either way, he'll have the PHP and ASP versions.

Bill Parrott
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)
Go to Top of Page

Jezmeister
Senior Member

United Kingdom
1141 Posts

Posted - 11 February 2008 :  16:56:30  Show Profile  Visit Jezmeister's Homepage
lol thanks guys, yes I was really after the vbs solution, it's php i'm avoiding like the plague :)

quote:
Edit: You could do it with a RegEx too, but (IMHO) its a little more work than its worth for something so simple.


Yeah... I have this obsession with using regex for anything I can these days... personally I blame xkcd... hehe

Edited by - Jezmeister on 11 February 2008 16:59:16
Go to Top of Page

AnonJr
Moderator

United States
5768 Posts

Posted - 11 February 2008 :  17:08:07  Show Profile  Visit AnonJr's Homepage
I saw that one too. While I do believe that there are many places they don't get used when they should, I also believe that there are too often times where they are used when they shouldn't... but that's just me.

I'm also not sure I'd be avoiding PHP... when MS finally gives Classic ASP the axe, I'm more likely to move to PHP than ASP.NET. But again, that's just me.
Go to Top of Page

Jezmeister
Senior Member

United Kingdom
1141 Posts

Posted - 11 February 2008 :  17:19:44  Show Profile  Visit Jezmeister's Homepage
It's too much effort lol when I learnt ASP I had all the time in the world for it, I simply don't now - I don't even have the time to further my knowledge of ASP let alone learn a whole new language... when MS gives ASP the axe I'll probably just say goodbye to this particular hobby - take up tiddlywinks instead heh
Go to Top of Page

muzishun
Senior Member

United States
1079 Posts

Posted - 11 February 2008 :  17:57:19  Show Profile  Visit muzishun's Homepage
I agree with AnonJr in that I am more likely to move to PHP when classic ASP finally goes away. However, if you have worked with JavaScript a decent amount, I have found that it helps a bit when easing into PHP. The first time I used PHP (only a couple years ago), it looked like gobbledegook. After I got better with JS, it still looked like gobbledegook, but it was a little easier to read. That being said, I *still* use php.net, google, and w3schools all the time at work. And I work almost entirely with PHP in the office!

Never give up the hobby. The beauty of it is there's always something else to learn.

Bill Parrott
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.3 seconds. Powered By: Snitz Forums 2000 Version 3.4.07