I have strings of jpg name
a = '123a.jpg'
b = '456asa.jpg'
c = '789pa.jpg'
Is there a way to replace the final a before .jpg with b?
new_a = '123b.jpg'
new_b = '456asb.jpg'
new_c = '789pb.jpg'
>Solution :
Using a small work arround:
a = a.split('').reversed.join().replaceFirst('a', 'b').split('').reversed.join();