Субъективный Си / Говнокод #18205 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
/**
*\brief isinteger
 *isinteger function will check if the NSString is a number or not
 * \Param    NSSting*
 * \return    true or false
 */
bool isinteger(NSString* theString)
{
    int myInt;
    NSScanner *theScanner = [NSScanner scannerWithString:theString];
    if ([theScanner scanInt:&myInt] && [theScanner isAtEnd] )
        return true;
    else
        return false;
}

Такой чудо-код встретился в проекте.

Запостил: EMax EMax, (Updated )

Комментарии (9) RSS

  • NSPaper *thePaper = [NSPaper paperWithFormat: kPaperFormatA4];
    NSPrinter *thePrinter = [NSPrinter printerWithPaper: thePaper];
    [thePrinter printString: theString];
    NSScanner *theScanner = [NSScanner scannerWithPaper: thePaper];
    Ответить
  • return ([theScanner scanInt:&myInt] && [theScanner isAtEnd] );

    остальное вполне могло бы сгодиться - ну разница вам, будете вы искать через regular expression, вручную или через NSScanner?
    Ответить
  • Такое часто бывает, когда человек не умеет пользоваться консольным дебаггером. Ставят кейсы для отладки, значение посмотреть.
    Ответить
  • If my problem was a Death Star, this article is a photon <a href="http://doyekgnn.com">toderpo.</a>
    Ответить
  • Nonihtg I could say would give you undue credit for this story. http://phvgwpijvt.com [url=http://eptbexyphuu.com]eptbexyphuu[/url] [link=http://mcyefjgfmw.com]mcyefjgfmw[/link]
    Ответить

Добавить комментарий

Помни, guest, за тобой могут следить!

    А не использовать ли нам bbcode?


    8