473,241 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,241 software developers and data experts.

Folder Name Function

Hi group!

I have a code to process text, to make it url/folder fiendly. (code
The only problem i have, is that the
$foldername = ereg_replace("[^[:alnum:] ]","",$foldername);
part deletes all spaces, but as you can see, i want spaces to become
which are no ALNUM-chars.
How can i solve this?

Greetings Frizzle.

///// C O D E /////

$foldername = stripslashes ( $_POST['foldername'] );
//This erase white-spaces on the beginning and the end:
$foldername = preg_replace('~^(\s*)(.*?)(\s*)$~m', "\\2", $foldername);
// replace all weird chars
$special_chars =
array('','','','','','','','','','','', '','','','','','','','','','','','',' ','','','','','','','','','','','','', '','','','','','','','','','','','',' ','','','','','C','c','C','c');
$special_replacements =
array('A','A','A','A','A','A','C','E','E','E','E', 'I','I','I','I','N','O','O','O','O','O','U','U','U ','U','Y','a','a','a','a','a','a','c','e','e','e', 'e','i','i','i','i','n','o','o','o','o','o','u','u ','u','u','y','y','C','c','C','c');
$foldername = str_replace($special_chars, $special_replacements,
//erases all NON-alfanumerics
$foldername = ereg_replace("[^[:alnum:] ]","",$foldername);
// take out repetative spaces:
$foldername = preg_replace('/\s\s+/', ' ', $foldername);
$foldername = preg_replace('/\s/', '_', $foldername);
$foldername = strtolower($foldername);
if ($foldername == ""){$foldername = "untitled";}

Oct 5 '05 #1
0 1179

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: jenny | last post by:
Hi, I am trying to find a VB way that would create a folder on all existing drives - the folder name would be the same on each drive. ie c:\backup, d:\backup, etc. But the folders would only be...
by: Wayne | last post by:
I'm using the following code from the Access Web to open a folder. The folder opens in "List" View. Is there an addition that I can make to the code to force the folder to open in "Details" view?...
by: Salad | last post by:
I designed a small app and I wanted to do a BrowseFolder (see http://www.mvps.org/access/api/api0002.htm), basically do a file open diaglog and select a directory/folder. The problem is that you...
by: Morten | last post by:
Hi! I'm trying to manage public folders using C#. I have found some code that allows me to mail enable a folder: foreach( System.Management.ManagementObject instmailbox in queryCollection ) {...
by: John Regan | last post by:
Hello All I am trying to find the owner of a file or folder on our network (Windows 2000 Server) using VB.Net and/or API. so I can search for Folders that don't follow our company's specified...
by: trialproduct2004 | last post by:
Hi all I am having one application where i want to implement new feature that is 'create new folder'. and display new folder name in listview. My listview is editable. My problem is i want to...
by: Paw | last post by:
Greetings. I use asp. what I need is is when a visitor comes to the site, I need it to check the host name. if "www.hometowndigest.com" is the host, then check a folder named "something" and if...
by: Nick 'The Database Guy' | last post by:
Hi All, I want to browse to a particular folder, not a particular file. The reason for this is that I have a utility that asks people to browse to a certain file, and I want them to be able to...
by: parshupooja | last post by:
Contact Reply 1 point Member propoo Joined on 08-31-2007, 10:32 PM Posts 3 Hey all ,
by: evenlater | last post by:
I have an Access application on a terminal server. Sometimes my users need to export reports to pdf, rtf or xls files and save them to their own client device hard drives. They can do that right...
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.