今天在写一个判断字符串是否回文时因为短路求值问题导致了一个bug,记录如下:代码如下bool isPal(char str[],int len){ int begin=0; int end=len-1; bool result=true; cout<<str<<endl; ...
分类:
其他好文 时间:
2014-07-09 19:00:02
阅读次数:
216
http://202.121.199.212/JudgeOnline/problem.php?cid=1079&pid=21
分析: 回文串判断,字符串处理
1. atoi 函数(ascii tointeger 将字符串转换成整型数)
头文件: #include
int atoi(cons...
分类:
其他好文 时间:
2014-07-09 11:38:26
阅读次数:
208
//判断两字符串是否相等- (BOOL)isEqualToString:(NSString *)aString;//判断开头是否包含该字符串- (BOOL)hasPrefix:(NSString *)aString;//判断结尾是否包含该字符串- (BOOL)hasSuffix:(NSString ...
分类:
其他好文 时间:
2014-07-06 22:08:25
阅读次数:
182
//_roaldSearchTextif([roadTitleLab.text rangeOfString:@"格力"].location !=NSNotFound) NSLog(@"yes");else NSLog(@"no");
分类:
移动开发 时间:
2014-07-06 21:52:19
阅读次数:
253
1、判断字符串是否包含某个字符
if( [str rangeOfString:@"hello"].location != NSNotFound) {
NSLog(@"yes");
} else {
NSLog(@...
分类:
移动开发 时间:
2014-07-06 11:18:41
阅读次数:
226
面试总结
今天去了北京著名IT公司进行PHP程序员的面试。这是人生第一次么,怎么不紧张?我是不是有病。不是,这叫自信呵.
首先是做一些笔试题。
1.mysql数据库索引使用的数据结构?这样做的好处是?
可以参考这篇博文:http://blog.csdn.net/ant_ren/article/details/2932068
2.有两个字符串a和b,判断b字符串是否出现在a中。...
分类:
Web程序 时间:
2014-06-15 19:44:31
阅读次数:
236
Given an array of strings, return all groups of
strings that are anagrams.Note: All inputs will be in lower-case.题解:
判断字符串是否为回文构词法生成的。找出所有由同一回文构词法生成的字...
分类:
其他好文 时间:
2014-06-12 13:51:32
阅读次数:
200
代码清单:
<?php
/**
* 判断字符串是否为utf8编码,英文和半角字符返回ture
* @author ruxing.li
* @param $string
* @return bool
*/
function is_utf8($string) {
return preg_match('%^(?:
[\x09\x0A\x0D\x...
分类:
其他好文 时间:
2014-06-08 10:47:58
阅读次数:
267
var Cts = "bblText";
if(Cts.indexOf("Text") > 0 )
{
alert('Cts中包含Text字符串');
}
indexOf用法:
返回 String 对象内第一次出现子字符串的字符位置。
strObj.indexOf(subString[, startIndex])
参数
...
分类:
Web程序 时间:
2014-06-08 05:00:36
阅读次数:
300