strstr(str1,str2) 函数用于判断字符串str2是否是str1的子串。如果是,则该函数返回str2在str1中首次出现的地址;否则,返回NULL。
PHP语言函数
编辑
strstr() 函数搜索一个字符串在另一个字符串中的第一次出现。
该函数返回字符串的其余部分(从匹配点)。如果未找到所搜索的字符串,则返回 false。
语法
...
分类:
编程语言 时间:
2016-05-12 12:20:56
阅读次数:
1108
1、如果能将类的方法定义成static,就尽量定义成static,它的速度会提升将近4倍。2、$row[’id’] 的速度是$row[id]的7倍。3、echo 比 print 快,并且使用echo的多重参数(译注:指用逗号而不是句点)代替字符串连接,比如echo $str1,$str2。4、在执行 ...
分类:
Web程序 时间:
2016-05-09 08:31:16
阅读次数:
276
//path包含处理路径的方法
var path = require('path');
//fs模块包含所有文件操作函数
var fs = require('fs');var str1 = "/home";
var str2 = "/git";
var str3 = "/NodeExploring";
//路径拼接
var dirPath = path.join(str1, str2, str3);...
分类:
Web程序 时间:
2016-05-07 11:12:15
阅读次数:
304
先介绍下关于数据库的连接:
我们首先通过connection对象对数据连接:
string str1 = Application.StartupPath;
string str = "provider=Microsoft.Jet.OLEDB.4.0; data Source="+str1+@"\telephone.mdb; Persist Security Info=F...
分类:
数据库 时间:
2016-05-07 11:02:13
阅读次数:
448
问题描述:输入两个字符串str1和p,将str1中的某个字符替换为字符串p。 分析:这个问题其实就是编程语言里的字符替换库函数,我们需要自己去实现,需要找出一种高效的办法,对于这道题存在两种解法。 解法一:从头开始扫描字符串str1,每次遇到空格后,插入字符串P,再插入字符串P之前,需要先将空格后面 ...
分类:
其他好文 时间:
2016-05-07 01:04:22
阅读次数:
153
decode的作用是将其他编码的字符串转换成unicode编码,如str1.decode('gb2312'),表示将gb2312编码的字符串str1转换成unicode编码。 encode的作用是将unicode编码转换成其他编码的字符串,如str2.encode('gb2312'),表示将unic ...
分类:
编程语言 时间:
2016-05-04 13:17:38
阅读次数:
245
一、正则表达式 1. “/”代表定界符,"^"代表起始符号,"$"代表结束符号 $str1="abc123def45ghjk6789lou"; $str2="abcde5fg2h6jkl"; $reg="/\d/"; //匹配一个数字 2. echo preg_replace($reg,"#",$s ...
分类:
编程语言 时间:
2016-05-02 19:52:53
阅读次数:
302
public class Demo1 {
public static void main(String[] args) {
String str1 = "hello";
String str2 = "hello";
String str3 = new String("hello");
String str4 = new String("hello");
System...
分类:
编程语言 时间:
2016-04-29 16:54:30
阅读次数:
198
select substr(index_code, 1, locate('-', index_code)-1) from report_data substr(str,m,n)表示从str中的m个字符开始截取n个字符。注:m从1开始计数。 locate(str1,str2, <pos>)表示在str ...
分类:
数据库 时间:
2016-04-29 13:57:30
阅读次数:
279
public class Demo1 {
public static void main(String[] args) {
String str1 = "hello";
String str2 = "hello";
String str3 = new String("hello");
String str4 = new String("hello");
System...
分类:
编程语言 时间:
2016-04-26 19:38:18
阅读次数:
233