1, test string length (Chinese in English)
Function Strlen (s) {VAR I, STR1, STR2, STR3, NLEN; STR1 = S.Value; Nlen = 0; for (i = 1; i <= str1.length; i ) {str2 = str1.substring (i -1, i) STR3 = escape (str2); if (str3.length> 3) {nlen = Nlen 2;} else {nlen = Nlen 1;}} return nlen;} 2, replacement
Function Replace (S1, S2, S3) {VAR LEN1, LEN2, I; VAR STR1, STR2; STR1 = S1; LEN1 = Str1.Length; LEN2 = S2.LENGTH; IF (LEN2> LEN1) RETURN S1; for (i = 1; i <= len1-len2 1; i ) {str2 = str1.substring (i-1, i-1 len2); if (str2 == s2) {str1 = str1.substring (0, I- 1) S3 str1.substring (i len2-1, len1); â = 0; len1 = str1.length;}} Return str1;}
3, look for Function POS (S1, S2) {VAR LEN1, LEN2, I, FLAG; VAR STR1, STR2; STR1 = S1; LEN1 = Str1.Length; LEN2 = S2.LENGTH; IF (len2 == 0 || LEN1 == 0) RETURN 0; FLAG = false; if (len2> len1) Return S1; for (i = 1; i <= len1-len2 1; i ) {str2 = str1.substring (i-1, i- 1 len2); if (str2 == s2) {Flag = true; Break;}} f (flag) Return I; else return 0;}