lib/knj/strings.rb in knjrbfw-0.0.107 vs lib/knj/strings.rb in knjrbfw-0.0.108

- old
+ new

@@ -337,6 +337,11 @@ #Takes a string and converts it to a safe string for filenames. def self.sanitize_filename(filename) return filename.gsub(/[^0-9A-z.\-]/, '_').gsub("\\", "_") end + + # Removes all non-ASCII parts of a string. + def self.remove_non_ascii(str, replacement = "") + return str.gsub(/\P{ASCII}/, '') + end end \ No newline at end of file