String 값을 구분자를 기준으로 하여 재배치.
EX) Dim path = &posx=598,598,601,601,604,604,610,646,652,652,655,700,709,709,685,664,661,616,613,580,586,571,568,562,556,556,547,556,601,604,616,619,619,613,613,610,607,598,592,586,586,592,613,616,634,637,670,673,724,727,727,697,697,670,661,658,655,652,652,649,649,652,652,664,664,664 &posy=494,486,482,470,466,462,454,454,446,438,434,434,422,394,366,366,370,370,374,374,398,398,402,402,410,414,454,466,466,470,470,474,486,494,506,510,510,554,554,546,538,530,530,526,526,522,522,518,518,522,562,150,262,298,298,302,302,306,342,346,458,462,466,482,498,506 &arrcount=14,26,37,51,66 &movekind=MR,ES,ES,MV &moveidcode=pointtest2,des2-1_1,es1_2,es-1_2,point_1_2_ &building=탑승동,여객터미널,여객터미널,여객터미널,교통센터 &floor=2,2,1,-1,-1 &movetime=25 &movedistance=598
에서 변수의 값들을 ,를 구분자로하여 역순으로 재배치.
더보기 접기
사용함수 : Split, Sort, Join
1. Split : 구분자를 기준으로 결과물을 쪼개는 명령어.
Ex) Dim splitString
splitString = Split( result, "&" )
--> splitString(0) : posx=598,598,601,601,604,604,610............
splitString(1) : posy=494,486,482,470,466,462,454............
2. sort Array : 배열의 Index 값들을 역순으로 배열에 대입한다.
Ex) Dim tempArr()
for j=0 to ubound(tempArr,1)/2
temp = tempArr(j)
tempArr(j) = tempArr( ubound(tempArr) - j )
tempArr( ubound(tempArr) - j ) = temp
next
3. Join : 배열의 요소들을 하나의 문자열로 묶기.
Ex) tempStr = join( tempArr, "," )
findway.asp 수정사항
'''''''''''''''''''''''''''''''''' 2012-04-19 '''''''''''''''''''''''''''''' If startpos = "uBoard3001" Or startpos = "uBoard3002" then
If obj.SmartFindway2 (endpos,startpos,1, RotateMap ) = 1 then path = obj.Path End If
retPath = "" tempPath = path splitString = Split( tempPath, "&" )
for i=0 to ubound( splitString, 1 ) tempStr = Mid( splitString(i), Instr( splitString(i), "=" )+1, Len(splitString(i)) ) tempArr = split( tempStr, "," ) If i = 0 then count = ubound( tempArr, 1 ) + 1 End If for j=0 to ubound(tempArr,1)/2 temp = tempArr(j) tempArr(j) = tempArr( ubound(tempArr) - j ) tempArr( ubound(tempArr) - j ) = temp next
If Instr(splitString(i),"arrcount=") > 0 then for k=0 to ubound(tempArr, 1 ) - 1 tempArr(k) = count - CInt(tempArr(k+1)) next tempArr( ubound(tempArr, 1 ) ) = count End If
tempStr = join( tempArr, "," ) tempStr = "&" + Left( splitString(i), Instr( splitString(i), "=" ) ) + tempStr
retPath = retPath + tempStr next
response.write retPath ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
접기