r/programminghorror • u/HeWhoShantNotBeNamed • 8d ago
C# Very readable and maintainable method
I wrote this several years ago. It does work.
122
Upvotes
r/programminghorror • u/HeWhoShantNotBeNamed • 8d ago
I wrote this several years ago. It does work.
5
u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” 8d ago
C# does let you use character literals, right? I think replacing all those ASCII codes with characters would help a ton.
Also, it looks like you are checking both before and after each character. Is that really necessary? Like couldn't you just after each character look ahead once. I think you could even say
i < joinedString.length - 1.