統計字符串中某個字符的個數

int numberPoint = 0;spa

    

    for (int i = 0; i<self.myTextCostWeight.text.length; i++)3d

    {string

        NSString * temp = [self.myTextCostWeight.text substringWithRange:NSMakeRange(i, 1)];it


        if ([temp isEqualToString:@"."])margin

        {top

            numberPoint ++;co

        }message

    

    }

    

    if (numberPoint >=2)

    {

        UIAlertView * alert = [[UIAlertView alloc]initWithTitle:@"價格" message:@"輸入太多 . " delegate:self cancelButtonTitle:nil otherButtonTitles:@"確認", nil];

        [alert show];

    }

相關文章
相關標籤/搜索