The code _javascript skill of the ASP's Word segmentation implementation
Source: Internet
Author: User
<%
A= "Japan is a province of China | Our beautiful china Zhangjiajie!" "
B= "China, we, Zhangjiajie, Japan, USA, Apple"
B=split (b, ",")
A=split (A, "|")
For K=0 to UBound (a)
S= ""
N= ""
For i=0 to UBound (b)
If InStr (A (k), B (i)) >0 then
S=s & InStr (A (k), B (i)) & "," &instr (A (k), B (i)) +len (b (i)) & ","
End If
Next
S=left (S,len (s)-1)
If left (S,len (s)-1) <>len (A (k)) then s=s& "," &len (A (k)) +1
S=sort (Split (S, ","))
For I=0 to UBound (s)-1
N=n&mid (A (k), S (i), S (i+1)-S (i)) & "|"
Next
Response.Write N & "<br>"
Next
function sort (ary)
Ck=true
Do Until CK = False
Ck=false
For f = 0 to UBound (ary)-1
If CLng (ary (f)) >clng (ary (f+1)) Then
V1=CLNG (ary (f))
V2=CLNG (ary (f+1))
ary (f) =v2
ary (f+1) =v1
Ck=true
End If
Next
Loop
Sort=ary
End Function
%>
Run results
Japan | is a province | in China |
We | | | | |-China | |-Zhangjiajie |!|
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.