我正在尝试使用源代码生成两个源代码,对于网络和手机,我想写一个像这样的源代码:
...
import {MAT_MOMENT_DATE_FORMATS, MomentDateAdapter} from '@angular/material-moment-adapter';
import {DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE} from '@angular/material/core';
// Depending on whether rollup is used, moment needs to be imported differently.
// Since Moment.js doesn't have a default export, we normally need to import using the `* as`
// syntax. However, rollup creates a synthetic default module and we thus need to import it using
// the `default as` syntax.
import * as _moment from 'moment';
// tslint:disable-next-line:no-duplicate-imports
import {default as _rollupMoment} from 'moment';
const moment = _rollupMoment || _moment;
/** @title Datepicker that uses Moment.js dates */
@Component({
...
providers: [
// `MomentDateAdapter` and `MAT_MOMENT_DATE_FORMATS` can be automatically provided by importing
// `MatMomentDateModule` in your applications root module. We provide it at the component level
// here, due to limitations of our example generation script.
{provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE]},
{provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS},
],
})
export class DatepickerMomentExample {
// Datepicker takes `Moment` objects instead of `Date` objects.
date = new FormControl(moment([2017, 0, 1]));
}
我听说使用正则表达式并不容易替换块,内部de块不会写注释或奇怪的字符,但我不知道这是什么更好的字符串,我可以使用正则表达式来使这更容易。< / p>
如果我想获得手机的纯粹分享并保存到新文件;我只是调用正则表达式函数来删除Web部件,反之亦然......
任何人都知道我可以用来实现这个目标的最佳字符串是什么?
更新1:
在这种情况下,正则表达式不起作用,{*Phone
import webfunction from ./utils
*/Phone}
...anothercode..
{*Web
import webfunction from ./utils
*/Web}
...anothercode..
ddd