码迷,mamicode.com
首页 >  
搜索关键字:length    ( 19575个结果
0长度数组的使用
0长度的数组在ISO C和C++的规格说明书中是不允许的,但是GCC的C99支持的这种用法。GCC对0长度数组的文档参考:“Arrays of Length Zero”如下代码片段,哪个更简洁更灵活,看一眼就知道了:#include #include typedef struct tagArray....
分类:其他好文   时间:2014-07-07 08:25:56    阅读次数:235
一些提高脚本性能的tips
把重复操作作为参数放在循环里面进行时非常低效的。比如:while i < len(str): print str[i]每次循环迭代都要运行len()这个函数,所以可改为如下提高效率:length = len(str)while i < length: print str[i]
分类:其他好文   时间:2014-07-07 00:47:19    阅读次数:185
字符串反转,
-(IBAction)abc:(id)sender{ NSString *a = @"abcdef"; NSMutableString *newA = [[NSMutableString alloc]init]; int length = a.length; for (int i = 0; ...
分类:其他好文   时间:2014-07-06 23:22:46    阅读次数:210
C# 判断文件夹是否为空
//pbak是要检查是否为空的文件夹路径 if (Directory.GetDirectories(pbak).Length > 0 || Directory.GetFiles(pbak).Length > 0) { Response.Write(""); }
分类:其他好文   时间:2014-07-06 22:13:49    阅读次数:629
银行卡号算法
function checkcard(banknumber) { //取出最后一位 var last = banknumber.substr(banknumber.length-1,1); //前15或18位 var front_last = ...
分类:其他好文   时间:2014-07-06 21:06:56    阅读次数:338
javascript实现当前页导航激活
html首页HTML/CSSJavaScriptSEO前端新闻javascript(给当前页面指定导航加了.on的class)$(function() {var a1 = document.URL;var a2 = $(“#nav a”);for (var i = 0; i < a2.length;...
分类:编程语言   时间:2014-07-05 20:25:32    阅读次数:320
Oracle单行函数笔记
Oracle中单行函数的分类:1.字符函数substr():字符串截取select substr('我爱你,你知道么?',0,4) from dual执行结果:我爱你,length函数:字符串长度select length('我爱你,你知道么?') from dual执行结果:9Replace()函...
分类:数据库   时间:2014-07-05 19:56:31    阅读次数:237
[算法]将字符串中的*前置,非*字符相对位置不变
如ab**cd*e12变成 ****abcde12char* foo(char* str, int length){ int i = length-1,j = length-1; while(i >= 0 && j >= 0){ while(i >= 0 && '*' !=...
分类:其他好文   时间:2014-07-03 23:52:49    阅读次数:314
leetcode-Longest Substring Without Repeating Characters 最长不重复子串
在一个字符串中求不重复子串的最大长度是一个经典的贪心法求解问题(说子串自然是连续的,子序列则不要求连续)。 先给出leetcode上这题的描述: Given a string, find the length of the longest substring without repeating characters. For example, the longest substring wit...
分类:其他好文   时间:2014-07-03 16:24:55    阅读次数:281
Substring with Concatenation of All Words
You are given a string,S, and a list of words,L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenati...
分类:其他好文   时间:2014-07-03 12:32:26    阅读次数:133
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!