转换字符串单词的第一个字母为大写

时间:2007-10-18 10:50:00 

本文介绍了一种将英文字符首个字母串转换为大写的asp代码,当然这个功能可能英文网站比较有用。

转换大写功能英文介绍:
Code Title: Proper Case
Description: You know how to use UCase and LCase, now here's Pcase! Ucase converts a string to all
UPPERCASE, and of course Lcase does the opposite, but this will convert any text string to Proper Case. It
basically capitalizes the first letter of every word in the string. Pretty cool, huh?!
Copy and paste this snippet as-is into your editor:

实现转换大写的asp函数代码:


<% 
Function PCase(strInput) 
iPosition = 1 
Do While InStr(iPosition, strInput, " ", 1) <> 0 
iSpace = InStr(iPosition, strInput, " ", 1) 
strOutput = strOutput & UCase(Mid(strInput, iPosition, 1)) 
strOutput = strOutput & LCase(Mid(strInput, iPosition + 1, iSpace - iPosition)) 
iPosition = iSpace + 1 
Loop 
strOutput = strOutput & UCase(Mid(strInput, iPosition, 1)) 
strOutput = strOutput & LCase(Mid(strInput, iPosition + 1)) 
PCase = strOutput 
End Function 
%> 


调用方法:


<html><body> 
转换字符串单词的第一个字母大写使用方法:<br> 
读取数据库字段例子: <%=PCase(rs("PG"))%> <br> 
读取asp参数.: <%=PCase(myVariable)%> <br> 
直接写入字符串.: <%=PCase("asp之家 www.aspxhome.com")%> <br> 
</body></html> 


标签:大写,字符串
0
投稿

猜你喜欢

  • Python中使用md5sum检查目录中相同文件代码分享

    2022-10-31 19:57:59
  • Flask交互基础(GET、 POST 、PUT、 DELETE)的使用

    2022-01-17 11:00:04
  • Python人脸检测实战之疲劳检测

    2021-02-23 16:31:37
  • mysql 8.0.20 winx64安装配置方法图文教程

    2024-01-27 02:09:01
  • 详解MySQL中的分组查询与连接查询语句

    2024-01-17 16:32:19
  • Python入门教程(四十一)Python的NumPy数组索引

    2023-07-17 01:38:55
  • Golang基础教程之字符串string实例详解

    2024-02-07 22:37:10
  • sql Set IDENTITY_INSERT的用法

    2024-01-14 14:27:47
  • 6个asp判断函数使用方法介绍

    2007-09-24 13:10:00
  • 遗传算法python版

    2021-04-29 23:36:20
  • MySQL如何查询Binlog 生成时间

    2024-01-19 23:34:57
  • MySQL查询缓存优化示例详析

    2024-01-27 12:21:32
  • Mysql出现问题:error while loading shared libraries: libaio解决方案

    2024-01-13 00:12:00
  • Python中浅拷贝copy与深拷贝deepcopy的简单理解

    2022-06-23 18:14:10
  • PHP chunk_split()函数讲解

    2023-06-09 13:54:44
  • python实现简易猜数小游戏

    2022-08-08 09:51:55
  • BootStrap给table表格的每一行添加一个按钮事件

    2024-05-11 09:07:33
  • 详解Go程序添加远程调用tcpdump功能

    2024-05-21 10:18:45
  • 微信小程序分包操作实战指南

    2024-04-16 08:47:57
  • 初学者必读:经典的数据库记录分页代码

    2009-01-08 15:27:00
  • asp之家 网络编程 m.aspxhome.com