IndexOf() 查找字串中指定字符或字串首次出现的位置,返首索引值,如: str1.IndexOf("字"); //查找“字”在str1中的索引值(位置) str1.IndexOf("字串");//查找“字串”的第一个字符在str1中的索引值(位置) str1.IndexOf("字",start...
分类:
其他好文 时间:
2014-09-03 19:42:57
阅读次数:
219
这篇文章源于同事问我说:
String str1 = "abc";
String str2 = "abc";
String str3 = new String("abc");
str1 == str2为true,是不是表示str1和str2分配在栈上面的?他们没有被new空间。
然后LZ自己YY了一下,想了个办法用eclipse来查看变量的堆栈分配,权威性有待考证,如有不当,有劳赐教!
...
分类:
系统相关 时间:
2014-09-03 11:16:26
阅读次数:
453
【题目简述】:字符串的简单处理,看懂题意,特别是他给的那个例子就好,很简单
见代码:
#include
#include
#include
#include
using namespace std;
char str[211][211];
int main()
{
int colum;
char str1[211];
int tmp;
while(cin>>colum,co...
分类:
其他好文 时间:
2014-09-02 21:25:55
阅读次数:
248
js字符串常用方法枚举/*
functionobj$(id)根据id得到对象
functionval$(id)根据id得到对象的值
functiontrim(str)删除左边和右边空格
functionltrim(str)删除左边空格
functionrtrim(str)删除右边空格
functionisEmpty(str)字串是否有值
functionequals(str1,str2)js判断比较两..
分类:
Web程序 时间:
2014-09-02 18:11:36
阅读次数:
269
定义一个函数,输入两个字符串,从第一个字符串中删除在第二个中出现过的所偶字符串。例如从第一个字符串"We are students."中删除第二个字符中“auiou”中出现过的字符得到的结果是"W r stdnts"
解题思路:利用哈希查找。
#include
void deleteStr2FromStr1(char* str1, char* str2)
{
if(str1 == NUL...
分类:
其他好文 时间:
2014-09-02 09:05:24
阅读次数:
250
字符串判断str1 = str2 当两个串有相同内容、长度时为真str1 != str2 当串str1和str2不等时为真-n str1 当串的长度大于0时为真(串非空)-z str1 当串的长度为0时为真(空串)str1 当串str1...
分类:
其他好文 时间:
2014-08-31 22:46:11
阅读次数:
176
??
1. istringstream字符串流
#include
#include
#include
using
namespace
std;
struct
MyStruct
{
string
str1,
str2,
str3;
double
db;
int
n...
分类:
其他好文 时间:
2014-08-30 23:11:28
阅读次数:
478
1 private String getTotalMemory() { 2 String str1 = "/proc/meminfo";// 系统内存信息文件 3 String str2; 4 String[] arrayOfString; 5 ...
分类:
移动开发 时间:
2014-08-30 20:24:59
阅读次数:
209
示例1:NSString *str1 = @"hello world"; //在oc当中,用NSString用来表示字符串 NSLog(@"%@",str1); //%@是oc当中,对象的格式符示例2:int a = 5;NSString *str2 = [NSString stringWithF....
分类:
其他好文 时间:
2014-08-30 17:36:29
阅读次数:
180
int LCS(string str1, string str2) //返回最长公共字串长度{ //创建矩阵 int** martix; martix = new int*[str1.length()+1]; for(int i =0; imax) {...
分类:
其他好文 时间:
2014-08-30 16:24:39
阅读次数:
151