summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx.rb
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2013-08-17 14:44:43 +0900
committerRandy Morgan <[email protected]>2013-08-17 14:44:43 +0900
commitaf1c2d1f5692f925a6dfd51cf2cb7d25a1ece0f6 (patch)
tree74d077a0b423e76b8115dc6bf38e8e85af9db075 /lib/axlsx.rb
parent7bd3f1fa3837f0387ac18f5caaac89d1986592a8 (diff)
downloadcaxlsx-af1c2d1f5692f925a6dfd51cf2cb7d25a1ece0f6.tar.gz
caxlsx-af1c2d1f5692f925a6dfd51cf2cb7d25a1ece0f6.zip
Extracted control char sanitization to module level and applied to shared strings table output.
Diffstat (limited to 'lib/axlsx.rb')
-rw-r--r--lib/axlsx.rb8
1 files changed, 8 insertions, 0 deletions
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