ASP問題

2006-12-11 9:38 am
我想問asp點先做到c++ "strtok"既功能???

回答 (2)

2006-12-15 9:39 pm
✔ 最佳答案
在ASP 裡面,有一個叫「Split」的 function,
可以做到類似如c++ 「strtok」 function 的功能。

圖片參考:http://hk.yimg.com/i/icon/16/1.gif
以下是詳細的講解:

Split ASP String Function
Are you trying to break a string up into smaller pieces? ASP provides an easy to use split function which lets you dice and slice a string.

Let's say you take in a sentence and want to put each word into a different variable. So you take in

NameStr = "Mr. John Smith"

Set up the array to hold the results with

Dim WordArray

then do the split, using a space as the split indicator

WordArray = Split(NameStr, " ")

Now WordArray(0) is equal to "Mr.", WordArray(1) is equal to "John" and WordArray(2) is equal to "Smith"! You can use various array functions and other string functions to work with these results.
2006-12-15 9:41 pm
USing the InStr function:
Located the first occurrence of a character or characters within a string.


收錄日期: 2021-04-13 21:30:45
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20061211000051KK00323

檢視 Wayback Machine 備份