Revision: 47497
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 9, 2011 03:53 by aludwig
Initial Code
// simpleStringMaker takes any string, and converts it to a simple, jpg-friendly name.
simpleStringMaker = function ( thestring, extension ) {
newstring = ""; // Init
for ( i = 0; i < thestring.length; i++ ) { // Loop through the string
if ( (thestring.charCodeAt(i) > 47 && thestring.charCodeAt(i) < 58) || (thestring.charCodeAt(i) > 96 && thestring.charCodeAt(i) < 123) || (thestring.charCodeAt(i) > 64 && thestring.charCodeAt(i) < 91) ) {
newstring += thestring.charAt(i).toLowerCase(); // If the string's char is a letter (upper or lower case) or a number, add it to newstring. Ignore it if it's anything else. Also, set the char to lower case either way.
}
}
trace( newstring + extension ); // Return
}
simpleStringMaker ( "It's 419 : Gotta Minute..?!", ".jpg" ); // Test
Initial URL
Initial Description
Initial Title
simpleStringMaker
Initial Tags
Initial Language
ActionScript