Moment.js在Safari中返回无效日期

时间:2018-02-08 09:47:46

标签: javascript safari momentjs

我有这段代码:

const char *es_strstr(const char *str1, const char *str2) {
    int i = 0;
    int j = 0;

    while (str1[j] != '?')    ///function has to stop the search to 
                             /// a question mark
    {
        if (*str1 == str2[i])    ///comparing main string first character
                                /// to substring first character
        {
            i++;
            ++str1;
            if (*str1 == str2[i])   ///if first ones are match then look
                                    /// for the next character matching
            {
                i++;
                ++str1;
                if (*str1 == str2[i])  /// finally if 2nd is match then 3rd
                {
                    --str1;
                    --str1;
                    printf("%c\n", *str1);
                    return *str1;
                }

            }
        }
        j++;
        i = 0;
        ++str1;
    }
    return NULL;           ///if nothing matches need to return NULL

int main(void) {
    char *main = "Foobarbaz?asd:w";
    char *sub = "baz?";
    es_strstr(main, sub);
    }

在Chrome和其他浏览器中,它没问题,但是safari会返回无效数据,因此循环无限...

0 个答案:

没有答案