Commit eca57538 authored by sixiaofeng's avatar sixiaofeng

1

parent f78c1fda
...@@ -9,10 +9,11 @@ export function makePy(str:string) { ...@@ -9,10 +9,11 @@ export function makePy(str:string) {
if(typeof(str) != "string") { if(typeof(str) != "string") {
throw new Error("函数makePy需要字符串类型参数!") throw new Error("函数makePy需要字符串类型参数!")
} }
var arrResult = new Array(); //保存中间结果的数组 const newStr = trim(str)
for(var i = 0, len = str.length; i < len; i++) { const arrResult = new Array() //保存中间结果的数组
for(let i = 0, len = newStr.length; i < len; i++) {
//获得unicode码 //获得unicode码
var ch = str.charAt(i) const ch = newStr.charAt(i)
//检查该unicode码是否在处理范围之内,在则返回该码对映汉字的拼音首字母,不在则调用其它函数处理 //检查该unicode码是否在处理范围之内,在则返回该码对映汉字的拼音首字母,不在则调用其它函数处理
arrResult.push(checkCh(ch)) arrResult.push(checkCh(ch))
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment