Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def substitution(inputText,charSub)
- @output = ''
- charSub.each{ |key,value| charSub[key] = '_' unless value }
- charSub.each do |key, value|
- @output = inputText.gsub(key.to_s , value.to_s)
- end
- return @output
- end
- Input:asfasdfsd
- Output:
- !sf!sdfsd
- a_fa_df_d
- as_asd_sd
- asfas_fs_
Add Comment
Please, Sign In to add comment