Antville Project

New function

Hallo everybody.

I've writen a function (for personal use of course) to replace invalid chars with nothing and "spaces" with "underscores".

I've added this to the global object.functions.js. I had Problems with different Browsers (on Linux :) when downloading files or images.

Its simply a copy of the regexp found in buildAliasFromFile plus the replacement of "spaces" with "underscores".

Look at the code:
/**

  • function replaces "invalid" webchars
  • @param name String the name to convert
  • @return String determined name "invalid" char free
    */

function replaceinvalidchars(name) {
// replace spaces with
var spaces = new RegExp(" ");
spaces.ignoreCase = true;
spaces.global = true;
name = name.replace(spaces,"
");
// clean name from any invalid characters
var invalidChars = new RegExp("[ \/?&=\+#äöüß\\]");
invalidChars.ignoreCase = true;
invalidChars.global = true;
return name.replace(invalidChars,"");
}

Second I added

param.alias = replaceinvalidchars(param.alias) ;

to the image and file object.functions.js. In the global object.functions.js i replaced the regexp with

line 459:
// clean name from any invalid characters
return replaceinvalidchars(name);

It's very simple maybe somebody adds it to the antville code if needed. Maybe nobody needs it.

Philipp

    


The Antville Server Fund has been a great success. Thanks to everybody who contributed!
online for 6352 Days
last updated: 1/4/11 10:22 AM
status
Youre not logged in ... Login
menu
November 2018
SunMonTueWedThuFriSat
123
45678910
11121314151617
18192021222324
252627282930
July
recent
Second Post Alert on Referrer
bug livecatz I put this into "help" and now here:...
by cobalt123 (7/26/03 7:14 PM)
clock not that it's particularly
earthshattering but the antclock is running slow by about 15...
by kohlehydrat (7/23/03 8:25 PM)
How to log skin names
I accessed to console?? Hi, I would like to know...
by winson (7/23/03 4:12 PM)

Click here to get an XML version of this weblog.

Made with Antville
powered by
Helma Object Publisher