public
Last active

Problem splitting a file

  • Download Gist
gistfile1.md
Markdown
def self.process_tweet(reply, requestlink)  
   @requestlink = requestlink 
   qry = reply.downcase.split

using a breakpoint to inspect 'reply' in my code - but cannot figure out why it is not splitting?

[1] pry(GuideSearch)> p reply                                                                                        
 "@twellyme film"                                                                                                     
=> "@twellyme film"                                                                                                  
[2] pry(GuideSearch)> p reply.class                                                                                  
String                                                                                                               
=> String                                                                                                            
[3] pry(GuideSearch)> p reply.split                                                                                  
["@twellyme film"]                                                                                                   
=> ["@twellyme film"]

yet when i make reply 'by hand':

[4] pry(GuideSearch)> reply = "@twellyme film"                                                                       
=> "@twellyme film"                                                                                                  
[5] pry(GuideSearch)> p reply.split                                                                                  
["@twellyme", "film"]                                                                                                
=> ["@twellyme", "film"]



[5] pry(GuideSearch)> p reply                                                                                        
"@twellyme film"                                                                                                     
=> "@twellyme film"                                                                                                  
[6] pry(GuideSearch)> reply = reply.gsub(/[^[:print:]]/, ' ')                                                        
=> "@twellyme film"                                                                                                  
[8] pry(GuideSearch)> reply.split                                                                                    
=> ["@twellyme film"]                                                                                                
[9] pry(GuideSearch)> p reply.split                                                                                  
["@twellyme film"]                                                                                                   
=> ["@twellyme film"]

1.9.3p286 :005 > "64 116 119 101 108 108 121 109 101 160 102 105 108 109".split.map{|c| c.to_i}.pack('c*')
=> "@twellyme\xA0film"
1.9.3p286 :006 > "64 116 119 101 108 108 121 109 101 160 102 105 108 109".split.map{|c| c.to_i}.pack('c*').split
=> ["@twellyme\xA0film"]
1.9.3p286 :007 > "64 116 119 101 108 108 121 109 101 160 102 105 108 109".split.map{|c| c.to_i}.pack('c*').gsub(/[^[:print:]]/, ' ').split
=> ["@twellyme", "film"]

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.