2011年2月28日
摘要:
'向指定的文件写字符串,第三个参数指定是否删除原来的内容Function Z_WriteFile(sFileName, sText, bAppend) Dim fs, fso, iomode if bAppend = True Then iomode = 8 'ForAppending else iomode = 2 'ForWriting end if set fs = CreateObject("Scripting.FileSystemObject") set fso = fs.OpenTextFile(sFileName, iomode, Tr
阅读全文
posted @ 2011-02-28 17:59
清清飞扬
阅读(823)
推荐(0)
摘要:
On error resume Next'删除字符串最右边的字符chsFunction MyRTrim(src, chs) '删除字符串最右边的字符chs(可多个) Dim pos, sLeft src = Trim(src) pos = InStrRev(src, chs) '查找最后一个字符chs if(pos > 0 and Len(Mid(src, pos+1)) = 0) Then sLeft = Left(src, pos - 1) '去除最后一个chs MyRTrim = MyRTrim(sLeft, chs) '去除尾部的chs e
阅读全文
posted @ 2011-02-28 14:54
清清飞扬
阅读(1452)
推荐(0)
2011年2月27日
摘要:
#if defined (_MSC_VER)#pragma warning(disable: 4786)#endif#include <iostream>#include <map>#include <algorithm>#include <conio.h>int main(int argc, char *argv[]){ /* define a map */ std::map<int, float> _map; /* insert */ _map.insert( std::map<int,float>::value_ty
阅读全文
posted @ 2011-02-27 23:15
清清飞扬
阅读(3001)
推荐(0)
摘要:
#include <iostream>#include <map>using namespace std;int main(){ map<int, string> m; m[0] = "h1"; m[3] = "what"; m.insert(pair<int, string>(4, "love you")); cout<<m[0].c_str()<<endl; cout<<m[3].c_str()<<endl; cout<<m
阅读全文
posted @ 2011-02-27 23:04
清清飞扬
阅读(11382)
推荐(0)
摘要:
'如文件名为:abc.txt, 则返回"abc"Function GetFileTitle(sFileName) '求文件的名称(不含扩展名) Dim pos pos = InStrRev(sFileName, ".") '从字符串尾部向前搜索子串(".") if(pos = 0) Then '文件无扩展名 GetFileTitle = sFileName else GetFileTitle = Left(sFileName, pos - 1) end ifEnd Function'删除sFol
阅读全文
posted @ 2011-02-27 16:59
清清飞扬
阅读(629)
推荐(0)
摘要:
vbs根据文件名取得文件Title(文件名中不含扩展名的部分):'如文件名为:abc.txt, 则返回"abc"Function GetFileTitle(sFileName) '求文件的名称(不含扩展名) Dim pos pos = InStrRev(sFileName, ".") '从字符串尾部向前搜索子串(".") if(pos = 0) Then '文件无扩展名 GetFileTitle = sFileName else GetFileTitle = Left(sFileName, pos -
阅读全文
posted @ 2011-02-27 16:14
清清飞扬
阅读(891)
推荐(0)
摘要:
vbscript的时间函数有好大一堆,可是真的用起来的时候却不一定方便,因为各个函数的作用不一样,用法也不完全一样,所以常常出现不知道用哪个函数来实现某个功能的情况。以下就是偶搜集的和时间相关的函数极其用法,如果有不完整的或是错误的地方欢迎大家补充指正第一部分:对时间的判断与数据格式变化(1)IsDate(expression)expression 参数可以是任意可被识别为日期和时间的日期表达式或字符串表达式。返回Boolean值.判断expression是否为合法的日期格式如:IsDate("2004-10-25 13:14:20"其值为true(2)CDate(date
阅读全文
posted @ 2011-02-27 15:46
清清飞扬
阅读(5265)
推荐(0)
摘要:
Dim sFolder, sExt, messagesFolder = "F:\Programming\Applications\VBScript"Dim fs, oFolder, oFiles, oSubFoldersset fs = CreateObject("Scripting.FileSystemObject")set oFolder = fs.GetFolder(sFolder) '获取文件夹set oSubFolders = oFolder.SubFolders '获取子目录集合for each folder in oSubF
阅读全文
posted @ 2011-02-27 15:09
清清飞扬
阅读(10312)
推荐(0)
摘要:
1.文件下载(无回显) echo iLocal = LCase(WScript.Arguments(1)) >iget.vbe echo iRemote = LCase(WScript.Arguments(0)) >>iget.vbe echo Set xPost = createObject("Microsoft.XMLHTTP") >>iget.vbe echo xPost.Open "GET",iRemote,0 >>iget.vbe echo xPost.Send() >>iget.vbe e
阅读全文
posted @ 2011-02-27 13:10
清清飞扬
阅读(1582)
推荐(1)
2011年2月26日
摘要:
Const ForReading = 1Dim messageDim fs, tsset fs = CreateObject("Scripting.FileSystemObject")set ts = fs.OpenTextFile("1.txt", ForReading)Do Until ts.AtEndOfStream message = ts.ReadLine '即使是空行,也会被读一次 if message <> "" Then MsgBox message End ifLoopts.Closeset ts
阅读全文
posted @ 2011-02-26 22:10
清清飞扬
阅读(7753)
推荐(0)