if [ str1 = str2 ] 当两个串有相同内容、长度时为真 if [ str1 != str2 ] 当串str1和str2不等时为真 if [ -n str1 ] 当串的长度大于0时为真(串非空) if [ -z str1 ] 当串的长度为0时为真(空串) if [ str1 ] 当串st ...
分类:
系统相关 时间:
2017-01-24 16:11:08
阅读次数:
260
public static String mul(String str1, String str2) { int minLength = -1; int maxLength = -1; if (str1.length() > str2.length()) { minLength = str2.len... ...
分类:
其他好文 时间:
2017-01-21 00:32:01
阅读次数:
162
#include<stdio.h>#include<string>#include<iostream>using namespace std; //高精度加法//只能是两个正数相加string add(string str1,string str2)//高精度加法{ string str; int ...
分类:
其他好文 时间:
2017-01-17 00:48:51
阅读次数:
271
PS:当n的位置使str3正好与str1中存在的与str3相同的序列有重合的单词的时候,就返回序列的值,否则就返回-1 返回把str1以str2为依据分割的字符串 StringBuilder创建器 StringBuffer是一次申请一片区域,速度就快 stringBuffer.append(Stri ...
分类:
其他好文 时间:
2017-01-16 22:44:24
阅读次数:
260
//利用时间和Guid作为种子产生随机数 private string GenerateUniqueID() { System.Text.StringBuilder sb = new System.Text.StringBuilder(); string str1 = DateTime.Now.To... ...
分类:
其他好文 时间:
2017-01-12 09:10:50
阅读次数:
180
1 public class Test{ 2 3 public static void main(String[] args){ 4 String str1 = "\"name\"";//字符串两边含有双引号 5 String str2 = "name \"is\" zcr";//字符串中间含有双引... ...
分类:
编程语言 时间:
2017-01-10 19:11:28
阅读次数:
200
1.直接赋值:string str= “hello”; 2.new(因为堆里面开辟了两块内存空间所以不常用):string str = new string(); 3.str内容不可更改 例:string str1 = “hello”; system.out.println(str1 + “worl ...
分类:
其他好文 时间:
2017-01-08 14:29:02
阅读次数:
157
C#split()方法使用split函数是一种用来截取字符串的函数,使用方法如下1.单字符串截取:stringstr=“1,2,3,4”;
string[]str1=str.split(‘,‘);结果为:12342.多字符串截取:stringstr=“1,2,3.4”;
string[]str1=str.split(newchar[2]{‘,‘,‘.‘});结果为:1234
#include #include using namespace std; int compareStr(string str1, string str2) { int num1 = str1.length(); int num2 = str2.length(); if(num1>num2) re... ...
分类:
其他好文 时间:
2016-12-29 22:52:53
阅读次数:
256
#include #include using namespace std; int dp[100][100]; int min(int a, int b) { if(a>str1>>str2; int num1 = strlen(str1); int num2 = strlen(str2); if... ...
分类:
其他好文 时间:
2016-12-29 07:12:36
阅读次数:
139