C语言允许函数的返回值是一个指针(地址),我们将这样的函数称为指针函数。下面的例子定义了一个函数strlong(),用来返回两个字符串中较长的一个。 /* 返回两个字符串中最长的一个 */ char *strlong(char *str1, char *str2) { if(strlen(str1) ...
分类:
其他好文 时间:
2019-11-07 16:29:46
阅读次数:
100
#include <iostream> #include <string> #include <cctype> using namespace std; int main() { string str1; string str2; int length; while(cin>>str1>>str2) ...
分类:
其他好文 时间:
2019-11-06 10:30:43
阅读次数:
74
#include <iostream> #include <string> #include <cctype> using namespace std; int main() { string str1; string str2; int length; while(cin>>str1>>str2) ...
分类:
其他好文 时间:
2019-11-06 10:27:19
阅读次数:
107
1.相关函数说明 CONCAT(string A/col, string B/col…): 返回输入字符串连接后的结果,支持任意个输入字符串; CONCAT_WS(separator, str1, str2,...): 它是一个特殊形式的 CONCAT()。 第一个参数剩余参数间的分隔符。 分隔符可 ...
分类:
编程语言 时间:
2019-11-06 01:06:59
阅读次数:
183
1.统计字符串的长度,按字节len(str) str := "hello北京" fmt.Println("str len=", len(str)) 2.字符串遍历,同时处理有中文的问题 r := []rune(str) str2 := "hello北京" r := []rune(str2) for ...
分类:
其他好文 时间:
2019-11-05 00:51:08
阅读次数:
106
摘要:本文主要介绍了一些公共运算符、公共方法的操作方式。 1、公共运算符 “+”: 1 str1 = 'aa' 2 str2 = 'bb' 3 4 list1 = [1, 2] 5 list2 = [10, 20] 6 7 t1 = (1, 2) 8 t2 = (10, 20) 9 10 dict1 ...
分类:
编程语言 时间:
2019-11-04 17:28:21
阅读次数:
95
int main() { string str1, str2; auto it1 = str1.begin(), it2 = str2.begin(); it1 == it2; return 0; } ...
分类:
其他好文 时间:
2019-11-03 20:13:08
阅读次数:
70
PS:串一定是连续的,序列可以是不连续的 时间复杂度O(len1*len2) 问题:求2个字符串的最长公共子串 字符串 str1="abcde",str2="abcde" 如果两个串相同,那么矩阵的对角线全都是1。 串1是abcdefg,串2是acdaefg 为了在求最长公共子串时,使得判断更加简单 ...
分类:
其他好文 时间:
2019-10-23 18:33:14
阅读次数:
62
str = ["a","b","c","d"]def ff(s): if s != "c": return sdd = filter(ff,str) #dd迭代器 filter只过滤不改变print(list(dd))print(dd)print(" ")str2=["g","h","k","l"] ...
分类:
其他好文 时间:
2019-10-17 21:49:24
阅读次数:
60
#include<stdio.h>#include<string.h>int main(){ int n,i,j=0,k,a[1000]; char str1[5]="push",str2[4]="pop",str3[4]="top",str[8]; while(~scanf("%d",&n)) { ...
分类:
其他好文 时间:
2019-10-13 20:33:42
阅读次数:
95