Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static String BackwardsNumCheck(ulong Num, String src)
- {
- Num = Num > 9 ? '9' : (char)Num + '0'; // could use a Max() here, if the platform has one? In C it'd be a macro...
- int len = src.Length();
- int i;
- bool carry = false;
- String ret = new String(' ', len); // I hope I can treat this like an array. String classes are ick.
- for (i = len; i--; ) {
- ret[i] = src[i] + (carry ? 1 : 0);
- if (carry = (ret[i]++ > Num)) {
- ret[i] = '1';
- }
- }
- return ret;
- }
Advertisement
Add Comment
Please, Sign In to add comment