Bass strings are never really affordable compared to guitar strings. What most players consider “good” strings or better than average are going to run $30-$60 USD.
If you get into the habit of wiping your strings off with a lint free cotton rag after playing you can prolong the life of the string quite a bit. Sweat from you hands is very corrosive.
Washing the food and gunk off your hands before playing helps too.
Just be glad you aren’t buying double bass strings, they can be easily over $100 a set.
Wiping my new strings with a Double Double is part of my break-in routine...

Tim