Skip to content

Commit

Permalink
Merge pull request dataxpress#65 from Coeur/format
Browse files Browse the repository at this point in the history
following the IEEE printf specification
  • Loading branch information
dataxpress committed Mar 10, 2019
2 parents a9df44c + bdacffb commit f49fc24
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion UICountingLabel.m
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 f49fc24

Please sign in to comment.