📄 bs_soundex.class.js
字号:
/********************************************************************************************* BlueShoes Framework; This file is part of the php application framework.* NOTE: This code is stripped (obfuscated). To get the clean documented code goto * www.blueshoes.org and register for the free open source *DEVELOPER* version or * buy the commercial version.* * In case you've already got the developer version, then this is one of the few * packages/classes that is only available to *PAYING* customers.* To get it go to www.blueshoes.org and buy a commercial version.* * @copyright www.blueshoes.org* @author Samuel Blume <sam at blueshoes dot org>* @author Andrej Arn <andrej at blueshoes dot org>*/function makesoundex() {this.a = -1this.b = 1this.c = 2this.d = 3this.e = -1this.f = 1this.g = 2this.h = -1this.i = -1this.j = 2this.k = 2this.l = 4this.m = 5this.n = 5this.o = -1this.p = 1this.q = 2this.r = 6this.s = 2this.t = 3this.u = -1this.v = 1this.w = -1this.x = 2this.y = -1this.z = 2}var sndx=new makesoundex()function isSurname(name) {if (name=="" || name==null) {return false;} else {}return true}function collapse(surname) {if (surname.length <= 1) {return surname;}var right=collapse(surname.substring(1,surname.length))if (sndx[surname.charAt(0)]==sndx[right.charAt(0)]) {return surname.charAt(0)+right.substring(1,right.length)}return surname.charAt(0)+right}function soundex(form) {form.result.value=""if (!isSurname(form.surname.value)) {return}var stage1=collapse(form.surname.value.toLowerCase())form.result.value+=stage1.charAt(0).toUpperCase()form.result.value+="-"var stage2=stage1.substring(1,stage1.length)var count=0for (var i=0; i<stage2.length && count<3; i++) {if (sndx[stage2.charAt(i)]>0) {form.result.value+=sndx[stage2.charAt(i)]count++}}for (; count<3; count++) {form.result.value+="0"}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -