Last active
December 26, 2015 09:59
-
-
Save holmeszyx/7133182 to your computer and use it in GitHub Desktop.
改了下名,好看一点点
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public function getLocation(_arg1:String):String{ | |
| var startvar:*; | |
| var blockCont:* = Number(_arg1.charAt(0)); | |
| var realString:* = _arg1.substring(1); | |
| var blockLength:* = Math.floor((realString.length / blockCont)); | |
| var remainLength:* = (realString.length % blockCont); | |
| var pool:* = new Array(); | |
| var currentIndex:* = 0; | |
| while (currentIndex < remainLength) { | |
| if (pool[currentIndex] == undefined){ | |
| pool[currentIndex] = ""; | |
| }; | |
| pool[currentIndex] = realString.substr(((blockLength + 1) * currentIndex), (blockLength + 1)); | |
| currentIndex++; | |
| }; | |
| currentIndex = remainLength; | |
| while (currentIndex < blockCont) { | |
| pool[currentIndex] = realString.substr(((blockLength * (currentIndex - remainLength)) + ((blockLength + 1) * remainLength)), blockLength); | |
| currentIndex++; | |
| }; | |
| var perString:* = ""; | |
| currentIndex = 0; | |
| while (currentIndex < pool[0].length) { | |
| startvar = 0; | |
| while (startvar < pool.length) { | |
| perString = (perString + pool[startvar].charAt(currentIndex)); | |
| startvar++; | |
| }; | |
| currentIndex++; | |
| }; | |
| perString = unescape(perString); | |
| var locationString:* = ""; | |
| currentIndex = 0; | |
| while (currentIndex < perString.length) { | |
| if (perString.charAt(currentIndex) == "^"){ | |
| locationString = (locationString + "0"); | |
| } else { | |
| locationString = (locationString + perString.charAt(currentIndex)); | |
| }; | |
| currentIndex++; | |
| }; | |
| locationString = locationString.replace("+", " "); | |
| return (locationString); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment