这是我在项目中写的一个Map对象: let map = new Map(); for (let i = 0; i < type_checked_value.length; i++) { let type_id = type_checked_value[i] map.set('type_' + typ ...
分类:
Web程序 时间:
2020-07-10 00:04:18
阅读次数:
82
此文基于switch的注意事项而发,其中某些情况可能并不常见,但还是小心为好,能够帮助我们精简代码(编译环境:cmder) 匹配项不精准 ①某些case可能永远匹配不到,造成浪费 package main import "fmt" func test(char byte) byte { return ...
分类:
其他好文 时间:
2020-07-09 22:33:34
阅读次数:
77
实现 strStr() 函数。 给定一个 haystack 字符串和一个 needle 字符串,在 haystack 字符串中找出 needle 字符串出现的第一个位置 (从0开始)。如果不存在,则返回 -1。 示例 1: 输入: haystack = "hello", needle = "ll"输 ...
分类:
其他好文 时间:
2020-07-09 12:16:10
阅读次数:
68
包 包是一个分层次的文件目录结构,它定义了一个由模块及子包,和子包下的子包等组成的 Python 的应用环境。 简单来说,包就是文件夹,但该文件夹下必须存在 __init__.py 文件, 该文件的内容可以为空。__init__.py 用于标识当前文件夹是一个包 1、包中的__init__.py _ ...
分类:
编程语言 时间:
2020-07-09 12:11:42
阅读次数:
57
https://studygolang.com/articles/11796 package main import ( "log" "net" ) func handleConnection(conn net.Conn) error { defer conn.Close() var request ...
分类:
Web程序 时间:
2020-07-08 21:28:55
阅读次数:
80
void func(int i, double d, const string& s) { cout << i << ", " << d << ", " << s << endl; } int main() { thread t(func, 1, 12.50, "sample"); t.join() ...
分类:
编程语言 时间:
2020-07-08 19:59:08
阅读次数:
81
#golang 几种字符串的连接方式 最近在做性能优化,有个函数里面的耗时特别长,看里面的操作大多是一些字符串拼接的操作,而字符串拼接在 golang 里面其实有很多种实现。 实现方法 1. 直接使用运算符 func BenchmarkAddStringWithOperator(b *testing ...
分类:
其他好文 时间:
2020-07-08 16:59:31
阅读次数:
75
一、基本数据类型 1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Title</title> 6 </head> 7 <body> 8 <div id="app"> 9 <!--页面从上向 ...
分类:
其他好文 时间:
2020-07-08 16:51:25
阅读次数:
43
<?php function demo01($a) { echo $a; } call_user_func("demo01", "hello world"); 输出 1.配合命令行参数使用 <?php //把第一个参数做为回调参数使用 $i = getopt("i:"); $i = $i['i']; ...
分类:
其他好文 时间:
2020-07-08 13:17:32
阅读次数:
63
Find Peak Element A peak element is an element that is greater than its neighbors. Given an input array nums, where nums[i] ≠ nums[i+1], find a peak e ...
分类:
其他好文 时间:
2020-07-08 13:03:15
阅读次数:
33