Skip to content

Commit

Permalink
following the IEEE printf specification
Browse files Browse the repository at this point in the history
  • Loading branch information
Coeur committed Mar 8, 2019
1 parent a9df44c commit bdacffb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion UICountingLabel.m
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@ - (void)setTextValue:(CGFloat)value
else
{
// check if counting with ints - cast to int
if([self.format rangeOfString:@"%(.*)d" options:NSRegularExpressionSearch].location != NSNotFound || [self.format rangeOfString:@"%(.*)i"].location != NSNotFound )
// regex based on IEEE printf specification: https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html
if([self.format rangeOfString:@"%[^fega]*[diouxc]" options:NSRegularExpressionSearch|NSCaseInsensitiveSearch].location != NSNotFound)
{
self.text = [NSString stringWithFormat:self.format,(int)value];
}
Expand Down

0 comments on commit bdacffb

Please sign in to comment.