Guest User

Untitled

a guest
Jun 17th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. def substitution(inputText,charSub)
  2. @output = ''
  3. charSub.each{ |key,value| charSub[key] = '_' unless value }
  4.  
  5. charSub.each do |key, value|
  6.  
  7.  
  8. @output = inputText.gsub(key.to_s , value.to_s)
  9.  
  10. end
  11.  
  12.  
  13.  
  14.  
  15.  
  16. return @output
  17.  
  18.  
  19. end
  20.  
  21. Input:asfasdfsd
  22. Output:
  23. !sf!sdfsd
  24. a_fa_df_d
  25. as_asd_sd
  26. asfas_fs_
Add Comment
Please, Sign In to add comment