NSNumber+YYAdd.h 762 B

123456789101112131415161718192021222324252627282930313233
  1. //
  2. // NSNumber+YYAdd.h
  3. // YYKit <https://github.com/ibireme/YYKit>
  4. //
  5. // Created by ibireme on 13/8/24.
  6. // Copyright (c) 2015 ibireme.
  7. //
  8. // This source code is licensed under the MIT-style license found in the
  9. // LICENSE file in the root directory of this source tree.
  10. //
  11. #import <Foundation/Foundation.h>
  12. NS_ASSUME_NONNULL_BEGIN
  13. /**
  14. Provide a method to parse `NSString` for `NSNumber`.
  15. */
  16. @interface NSNumber (YYAdd)
  17. /**
  18. Creates and returns an NSNumber object from a string.
  19. Valid format: @"12", @"12.345", @" -0xFF", @" .23e99 "...
  20. @param string The string described an number.
  21. @return an NSNumber when parse succeed, or nil if an error occurs.
  22. */
  23. + (nullable NSNumber *)numberWithString:(NSString *)string;
  24. @end
  25. NS_ASSUME_NONNULL_END