Skip to content

Instantly share code, notes, and snippets.

@mclockw
mclockw / strReplace.js
Created August 7, 2019 02:31
js 字符串用正则表达式来替换
var st = "04/16/2019";
var pattern = /(\d{2})\/(\d{2})\/(\d{4})/;
let formatStr = st.replace(pattern,'$3-$1-$2');
var dt = new Date(formatStr);
console.log("formatStr: ", formatStr);
console.log("dt: ", dt.toDateString());
/*
add this at the end of prepareRunLoop
*/
[_displayLink setPaused:YES];
/*
add this at the end of (void) applicationDidBecomeActive:
*/
video = [[InteractiveVideo alloc] initWithFrame:_window.bounds];
video.delegate = self;