From af1c2d1f5692f925a6dfd51cf2cb7d25a1ece0f6 Mon Sep 17 00:00:00 2001 From: Randy Morgan Date: Sat, 17 Aug 2013 14:44:43 +0900 Subject: Extracted control char sanitization to module level and applied to shared strings table output. --- lib/axlsx.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/axlsx.rb') diff --git a/lib/axlsx.rb b/lib/axlsx.rb index 8cecf47a..ffebc7ac 100644 --- a/lib/axlsx.rb +++ b/lib/axlsx.rb @@ -127,6 +127,14 @@ module Axlsx s.gsub(/_(.)/){ $1.upcase } end + # returns the provided string with all invalid control charaters + # removed. + # @param [String] str The sting to process + # @return [String] + def self.sanitize(str) + str.gsub(CONTROL_CHAR_REGEX, '') + end + # Instructs the serializer to not try to escape cell value input. # This will give you a huge speed bonus, but if you content has <, > or other xml character data -- cgit v1.2.3