国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

用數組移動字符串

2024-07-21 02:22:48
字體:
來源:轉載
供稿:網友
,歡迎訪問網頁設計愛好者web開發。這是2個對字符串處理的互逆函數
功能:移動字符串
用發:arymoveleft("字符串",移動的個數)
例:
dim strg
strg="123456789"
strg=arymoveleft(strg,2)

結果:strg="345678912"



public function arymoveleft(str, count)
if count = 0 then
arymoveleft = str
exit function
end if
dim a()
strlen = len(str)
redim a(strlen)
for i = 1 to len(str)
a(i) = mid(str, i, 1)
next
temp = a(1)
for i = 2 to len(str)
a(i - 1) = a(i)
next
a(strlen) = temp
for i = 1 to len(str)
result = result & a(i)
next
arymoveleft = arymoveleft(result, count - 1)
end function
public function arymoveright(str, count)
if count = 0 then
arymoveright = str
exit function
end if
dim a()
strlen = len(str)
redim a(strlen)
for i = 1 to len(str)
a(i) = mid(str, i, 1)
next
temp = a(strlen)
for i = len(str) to 2 step -1
a(i) = a(i - 1)
next
a(1) = temp
for i = 1 to len(str)
result = result & a(i)
next
arymoveright = arymoveright(result, count - 1)
end function
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 含山县| 大同县| 瓦房店市| 鲁山县| 米易县| 原平市| 庆城县| 新安县| 弋阳县| 会东县| 洛川县| 青冈县| 迁西县| 沙雅县| 克山县| 阜宁县| 沙河市| 巧家县| 南靖县| 都兰县| 淳化县| 宁阳县| 枣强县| 汶上县| 蓬安县| 河北省| 石台县| 霍邱县| 三明市| 富川| 广平县| 武夷山市| 延庆县| 剑阁县| 宜丰县| 泽普县| 宁夏| 珠海市| 南靖县| 万年县| 庆云县|