第一种:时间复杂度为O(n^2) 第二种:indexOf()与filter结合使用,环境支持es5,时间复杂度为O(n) 第三种:先排序sort(),再filter,时间复杂度为O(n) 第四种: 借助对象,时间复杂度为O(n),但是没有区分类型,比如2和”2” 第五种:set方法 ...
分类:
编程语言 时间:
2018-07-21 16:59:47
阅读次数:
125
1.利用正则表达 String s = "123.045600"; if(s.indexOf(".") > 0){ //正则表达 s = s.replaceAll("0+?$", "");//去掉后面无用的零 s = s.replaceAll("[.]$", "");//如小数点后面全是零则去掉小数 ...
分类:
其他好文 时间:
2018-07-21 15:08:20
阅读次数:
166
百度2017春招笔试真题编程题集合之买帽子 1 // 2017-10-09 2 // 题目描述 3 // 度度熊想去商场买一顶帽子,商场里有N顶帽子,有些帽子的价格可能相同。度度熊想买一顶价格第三便宜的帽子,问第三便宜的帽子价格是多少? 4 // 输入描述: 5 // 首先输入一个正整数N(N <= ...
分类:
编程语言 时间:
2018-07-21 15:05:33
阅读次数:
185
// var index = location.href; // console.log(index) // // indexOf() 方法可返回某个指定的字符串值在字符串中首次出现的位置。 // var demo = index.indexOf("?"); // console.log(demo)... ...
分类:
其他好文 时间:
2018-07-21 14:25:42
阅读次数:
94
1 function gainSearch (payload) { //payload 为查询关键字 2 const list = window.gainList // window.gainList 为一个对象数组 object[] 3 let arr = [] 4 list.filter((in... ...
分类:
其他好文 时间:
2018-07-20 12:34:17
阅读次数:
143
In this article, I am going to explain ,"How to Upload Images to the server using Cordova File Transfer Plugin and Asp.Net core Web API". Requirements ...
Zookeeper概念简介: Zookeeper是一个分布式协调服务;就是为用户的分布式应用程序提供协调服务 1、zookeeper是为别的分布式程序服务的(比如服务管理、心跳检查、配置信息管理) 2、Zookeeper本身就是一个分布式程序(只要有半数以上节点存活,zk就能正常服务) 3、Zook ...
分类:
其他好文 时间:
2018-07-18 20:36:43
阅读次数:
163
function GetRequest() { var url = location.search; //获取url中"?"符后的字串 var theRequest = new Object(); if (url.indexOf("?") != -1) { var str = url.substr( ...
分类:
Web程序 时间:
2018-07-18 14:25:59
阅读次数:
165
public static String getParam(String url, String name) { String params = url.substring(url.indexOf("?") + 1, url.length()); Map split = Splitter.on("&... ...
分类:
编程语言 时间:
2018-07-17 20:15:38
阅读次数:
274
一.字符串常用方法 1.IndexOf("") 如果找到字符串出现的位置则为索引位置,否则返回-1,索引从0开始 2.string Substring( int startIndex , int length ); 从开始位置startIndex,截取到结束位置(截取长度length) 3.Trim ...