获取文件名方法:用System.IO.Path.GetFileName和System.IO.Path.GetFileNameWithoutExtension(无扩展名)的方法获取文件路径方法://获取当前进程的完整路径,包含文件名(进程名)。string str = this.GetType().A...
C#MD5加密1、应用命名空间using System.Security.Cryptography;View Code2.添加方法 private string GetMD5(string str) { MD5CryptoServiceProvide...
分类:
其他好文 时间:
2014-07-14 08:14:18
阅读次数:
227
今天由于用GD画图, 需要把一段文字在一个框内居中, 但是文字的宽度如果用strlen($str) * $font_size来计算的话, 由于文字不是等宽高的, 所以会导致偏离, 最后选用的GD库的imagettfbbox()函数, 其原型如下array ImageTTFBBox(int size,...
分类:
Web程序 时间:
2014-07-13 23:55:24
阅读次数:
501
字典树查询
#include
#include
#include
using namespace std;
const int maxn = 30;
typedef struct Trie{
int v;
Trie *next[ maxn ];
}Trie;
Trie root;
void CreateTrie( char *str ){
int len = strlen( st...
分类:
其他好文 时间:
2014-07-13 17:17:39
阅读次数:
336
代码:
#include
#include
#include
#include
int main()
{
int num[100];
int odd = 0, even = 0;
std::string str;
getline(std::cin, str);
std::stringstream s(str);
int j = 0;
while(getline(s, s...
分类:
其他好文 时间:
2014-07-13 13:54:31
阅读次数:
280
在触摸设备上可以使用Qt的手势事件
要激活手势事件,需要执行以下操作:
第一步,设置QT程序版本
QApplication
app(argc,
argv);
QCoreApplication::setApplicationVersion(QT_VERSION_STR);
第二步,为QWidget控件注册手势事件
QListQt::GestureType> ge...
分类:
移动开发 时间:
2014-07-12 20:30:44
阅读次数:
807
字符串声明: var str1 = new String(“abcdefgabc”); //这是一个“字符串对象” var str2 = “abcdefgabc”; //这个字符串跟前面str1几乎没有区别str.length——获得一个字符串的长度(也就是字符个数)字符串对象的方法:...
分类:
Web程序 时间:
2014-07-12 15:40:52
阅读次数:
223
public class OperationString { public static void main(String[] args) { String str[]=new String [4];//定义长度为4的字符串数组 str[0]="first"; ...
分类:
其他好文 时间:
2014-07-12 15:22:36
阅读次数:
161
4.写一个setter方法用于完成@property (nonatomic,retain)NSString *name,写一个setter方法用于完成@property(nonatomic,copy)NSString *name-(void)setName:(NSString*)str{[strre...
分类:
移动开发 时间:
2014-07-12 15:03:09
阅读次数:
327
获取字符串的长度php中有一个神奇的函数,可以直接获取字符串的长度,这个函数就是strlen()。例子如下:$str = 'hello'; $len = strlen($str); echo $len;//输出结果是5strlen函数对于计算英文字符是非常的擅长,但是如果有中文汉字,要计算长度该怎么...
分类:
其他好文 时间:
2014-07-12 13:59:46
阅读次数:
234