快精灵印艺坊 您身边的文印专家
广州名片 深圳名片 会员卡 贵宾卡 印刷 设计教程
产品展示 在线订购 会员中心 产品模板 设计指南 在线编辑
 首页 名片设计   CorelDRAW   Illustrator   AuotoCAD   Painter   其他软件   Photoshop   Fireworks   Flash  

 » 彩色名片
 » PVC卡
 » 彩色磁性卡
 » 彩页/画册
 » 个性印务
 » 彩色不干胶
 » 明信片
   » 明信片
   » 彩色书签
   » 门挂
 » 其他产品与服务
   » 创业锦囊
   » 办公用品
     » 信封、信纸
     » 便签纸、斜面纸砖
     » 无碳复印纸
   » 海报
   » 大篇幅印刷
     » KT板
     » 海报
     » 横幅

一些源程序 - 获得文件大小和字符串处理

Formats passed string based on length. Perfect for emails and text files.
----------------------------------------------------------------------------
<%
\\\' Company: Sabra Inc
\\\' Author: Dave Hoffenberg
\\\' Date: 10/5/00
\\\' Function: Formats passed string based on length. Perfect for emails and text files.
\\\' Freeware

Function Padding(Value, Length)
\\\' If the length of the value is less than the variable \\\'length\\\'
If Len(Value) < Length Then
charcount = Length - len(Value)

for i = 1 to (charcount - 1)

padding = padding & " "

next

mystring = Value & padding
\\\' If the length of the value is greater than the variable \\\'length\\\'
Elseif len(Value) > Length Then
mystring = Left(Value,Length)

Else
set mystring = Value

End If

Padding = mystring

End Function


Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile(Server.MapPath("test.txt"), True)

MyFile.WriteLine Padding("this is a test", 25) & "end of line."

Set fso = Nothing
Set MyFile = Nothing

response.write "done"
%>

Retrieves file size(K) of any file passed to it.
---------------------------------------------------------------------------

<%
\\\' Company: Sabra Inc
\\\' Author: Dave Hoffenberg
\\\' Function: Retrieves file size(K) of any file name passed to it.
\\\' Freeware

Function ShowFileSize(filespec)
file = Server.MapPath(filespec)
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(file) Then
Set f = fso.GetFile(file)
intSizeB = f.Size
intSizeK = Int((intSizeB/1024) + .5)
If intSizeK = 0 Then intSizeK = 1
ShowFileSize = intSizeK & "k"
Else
ShowFileSize = "File Doesn\\\'t Exist"
End If
Set fso = Nothing
End Function

response.write ShowFileSize("test.txt")
%>
返回类别: 教程
上一教程: ASP中数据库安全问题之我见
下一教程: ASP访问ACCESS出错提示简要解释

您可以阅读与"一些源程序 - 获得文件大小和字符串处理"相关的教程:
· 改进 ASP 应用程序中的字符串处理性能
· ASP中一个字符串处理类加强版
· ASP中一个字符串处理类
· 改进 ASP 的字符串处理性能
· 截取固定长度字符串显示在页面,多余部分显示为省略号(区分汉字和字符)
    微笑服务 优质保证 索取样品