news
About Elegant Chaos
info
About me and my friends
people
Software from Elegant Chaos
software
Other stuff...
stuff

FL_LegalName

Revision
Revised on

Description

Try to return a legal file name. Takes a suggested name.

This routine tries to turn the string that it's passed in to a legal file name, by making sure that it isn't too long.

If the string is too long, vowels are removed until it is short enough. If this works it makes the name a bit weird, but usually leaves it readable! If this fails to make it short enough, the string is truncated.


Code

function FL_LegalName filename
  -- strip vowels as necessary
  put FL_stripLetter(filename,"a") into filename
  put FL_stripLetter(filename,"e") into filename
  put FL_stripLetter(filename,"i") into filename
  put FL_stripLetter(filename,"o") into filename
  put FL_stripLetter(filename,"u") into filename
  put FL_stripLetter(filename,",") into filename
  put FL_stripLetter(filename," ") into filename
  
  -- truncate any excess from name and return it
  delete char 0 to (length(filename)-30) of filename
  return filename
end FL_LegalName