我正在尝试使用下划线 sortBy 方法对对象数组进行排序,json 如下
[
{
"styleId": 91,
"styleName": "Style Label",
"dataSourceId": 1,
"dataSourceName": null,
"stationeryId": 1,
"stationeryName": null,
"styleType": 1,
"styleTypeName": "Labels",
"isActive": true,
"isPlainPaper": true,
"isSystemMaintained": false,
"isPublished": true,
"designerUrl": null,
"sourceStyleId": 0,
"rowIndicatorCode": 2,
"isDefault": null,
"hasElement": true,
"styleDesign": null,
"createdBy": "real",
"createdDate": 1494217733790,
"modifiedBy": "superuser",
"modifiedDate": 1494388952450,
"rowVersion": "AAAAAAIC8ls="
},
{
"styleId": 69,
"styleName": "irtest",
"dataSourceId": 1,
"dataSourceName": null,
"stationeryId": 16,
"stationeryName": null,
"styleType": 1,
"styleTypeName": "Labels",
"isActive": true,
"isPlainPaper": false,
"isSystemMaintained": false,
"isPublished": true,
"designerUrl": …Run Code Online (Sandbox Code Playgroud)您好我试图在Javascript中使用正则表达式来验证输入,我的要求是我在字符串中最多只能有一个点('.')并且不能在开头和结尾.我得到了一个解决方案
/^[^\.].*[^\.]$/;
Run Code Online (Sandbox Code Playgroud)
但问题是输入"x"被认为是无效的 有效输入,如"x","xx","xx.x","x.xx",如".x"和"x"之类的无效.