最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
可以把文章标题中的英文单词的首字母变成大写的函数
时间:2022-06-30 11:18:29 编辑:袖梨 来源:一聚教程网
功能说明:
可以把文章标题中的英文单词的首字母变成大写:)
<%
function PCase(strInput)
'Variable declaration.
Dim strArr
Dim tmpWord
Dim tmpString
Dim last
'Create an array To store Each word In the String separately.
strArr = split(strInput," ")
if ubound(strArr) > 0 Then
For x = lbound(strArr) To ubound(strArr)
'Set Each word To lower Case initially.
strArr(x) = LCase(strArr(x))
'Skip the unimportant words.
Select Case strArr(x)
Case "a"
Case "an"
Case "and"
Case "but"
Case "by"
Case "for"
Case "in"
Case "into"
Case "is"
Case "of"
Case "off"
Case "on"
Case "onto"
Case "or"
Case "the"
Case "to"
Case "a.m."
strArr(x) = "A.M."
Case "p.m."
strArr(x) = "P.M."
Case "b.c."
strArr(x) = "B.C."
Case "a.d."
strArr(x) = "A.D."
Case Else
'Capitalize the first letter, but don't forget To take into account that
'the String may be in Single or Double quotes.
if len(strArr(x)) > 1 Then
if mid(strArr(x),1,1) = "'" or mid(strArr(x),1,1) = """" Then
tmpWord = mid(strArr(x),1,1) & Ucase(mid(strArr(x),2,1)) & mid(strArr(x),3,len(strArr(x))-2)
Else
tmpWord = Ucase(mid(strArr(x),1,1)) & mid(strArr(x),2,len(strArr(x))-1)
可以把文章标题中的英文单词的首字母变成大写:)
<%
function PCase(strInput)
'Variable declaration.
Dim strArr
Dim tmpWord
Dim tmpString
Dim last
'Create an array To store Each word In the String separately.
strArr = split(strInput," ")
if ubound(strArr) > 0 Then
For x = lbound(strArr) To ubound(strArr)
'Set Each word To lower Case initially.
strArr(x) = LCase(strArr(x))
'Skip the unimportant words.
Select Case strArr(x)
Case "a"
Case "an"
Case "and"
Case "but"
Case "by"
Case "for"
Case "in"
Case "into"
Case "is"
Case "of"
Case "off"
Case "on"
Case "onto"
Case "or"
Case "the"
Case "to"
Case "a.m."
strArr(x) = "A.M."
Case "p.m."
strArr(x) = "P.M."
Case "b.c."
strArr(x) = "B.C."
Case "a.d."
strArr(x) = "A.D."
Case Else
'Capitalize the first letter, but don't forget To take into account that
'the String may be in Single or Double quotes.
if len(strArr(x)) > 1 Then
if mid(strArr(x),1,1) = "'" or mid(strArr(x),1,1) = """" Then
tmpWord = mid(strArr(x),1,1) & Ucase(mid(strArr(x),2,1)) & mid(strArr(x),3,len(strArr(x))-2)
Else
tmpWord = Ucase(mid(strArr(x),1,1)) & mid(strArr(x),2,len(strArr(x))-1)
相关文章
- 无期迷途主线前瞻直播总结 无期迷途主线前瞻直播内容介绍 11-22
- 以下哪种非遗技艺是用针在纸上绣画 蚂蚁新村11月21日答案 11-22
- 江南百景图听风塔怎么样 11-22
- 原神恰斯卡圣遗物怎么搭配 11-22
- 2024年霸王茶姬11月22日口令是什么 2024.11.22霸王茶姬口令介绍 11-22
- 光遇11.21季节蜡烛在哪里 光遇11月21日季节蜡烛位置攻略 11-22