Source Code Cross Referenced for StringUtilities.java in  » IDE-Netbeans » uml » org » netbeans » modules » uml » core » support » umlsupport » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » uml » org.netbeans.modules.uml.core.support.umlsupport 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:
042:        package org.netbeans.modules.uml.core.support.umlsupport;
043:
044:        import java.io.File;
045:        import java.io.IOException;
046:        import java.io.PushbackReader;
047:        import java.io.StringReader;
048:        import java.util.HashMap;
049:        import java.util.Map;
050:        import java.util.StringTokenizer;
051:        import org.netbeans.modules.uml.common.generics.ETPairT;
052:        import org.netbeans.modules.uml.core.support.umlutils.ETArrayList;
053:        import org.netbeans.modules.uml.core.support.umlutils.ETList;
054:
055:        /**
056:         * @author sumitabhk
057:         */
058:        public class StringUtilities {
059:            /**
060:             * Given a delimited string and the delimiter, this function removes the first
061:             * delimited token from @a delimitedString and returns it.
062:             *
063:             * Example Usage:
064:             *
065:             * String X         = "A::B::C";
066:             * String delimiter = "::";
067:             * String token     = StringUtilities.removeToken( X, delimiter );
068:             *
069:             *  results:
070:             *    token == "A"
071:             *
072:             * @param delimitedString[in,out] the delimited string (e.g. "A::B::C")
073:             * @param delimiter[in] the delimiter (e.g. "::")
074:             *
075:             * @return the first token
076:             */
077:            public static ETPairT<String, String> removeToken(String text,
078:                    String token) {
079:                if (text == null || token == null)
080:                    return new ETPairT<String, String>(text, "");
081:
082:                int pos = text.indexOf(token);
083:                String tok = pos != -1 ? text.substring(0, pos) : text;
084:                text = pos != -1 ? text.substring(pos + token.length()) : "";
085:                return new ETPairT<String, String>(tok, text);
086:            }
087:
088:            /**
089:             * 'Increments' a String that contains only lowercase alphabets. The last
090:             * letter in the String is 'incremented' to the next letter in alphabetical
091:             * order.<br/>
092:             * <p>
093:             * Examples:
094:             * <code>
095:             *  null and ""   become    "a"
096:             *  "e"           becomes   "f"
097:             *  "abc"         becomes   "abd"
098:             *  "z"           becomes   "aa"
099:             *  "abz"         becomes   "aca"
100:             * </code>
101:             * </p>
102:             *
103:             * The behaviour if the given String does not contain only lowercase letters
104:             * is undefined.
105:             *
106:             * @param id The String to increment.
107:             * @return The incremented String.
108:             */
109:            public static String incrementString(String id) {
110:                if (id == null || id.length() == 0)
111:                    return "a";
112:
113:                StringBuffer buf = new StringBuffer(id);
114:                for (int pos = buf.length() - 1; pos >= 0; --pos) {
115:                    char c = buf.charAt(pos);
116:                    c = c == 'z' ? 'a' : (char) (c + 1);
117:                    buf.setCharAt(pos, c);
118:
119:                    // If we didn't wrap a character around from 'z'->'a', we can exit
120:                    // early.
121:                    if (c != 'a')
122:                        break;
123:
124:                    // If we wrapped a character and this is the first character in the
125:                    // String, we need to insert a new character.
126:                    if (pos == 0)
127:                        buf.insert(0, "a");
128:                }
129:
130:                return buf.toString();
131:            }
132:
133:            /**
134:             * Parses a base-10 integer from the given String. Trailing non-numeric
135:             * characters will be ignored, and NumberFormatExceptions will be caught
136:             * and silently suppressed.
137:             *
138:             * @param text The String containing the number to be parsed.
139:             * @return The parsed <code>int</code>, defaulting to 0 if the String is
140:             *         unparseable.
141:             */
142:            public static int parseInt(String text) {
143:                if (text == null || text.length() == 0)
144:                    return 0;
145:
146:                int pos = findFirstNonDigit(text);
147:                if (pos != -1)
148:                    text = text.substring(0, pos);
149:
150:                try {
151:                    return Integer.parseInt(text);
152:                } catch (NumberFormatException e) {
153:                    return 0;
154:                }
155:            }
156:
157:            /**
158:             * Returns a String with the leading digits in 'text' stripped.
159:             * @param text The String to strip of leading digits.
160:             * @return 'text' without any leading digits.
161:             */
162:            public static String stripLeadingInteger(String text) {
163:                if (text == null || text.length() == 0)
164:                    return text;
165:
166:                int pos = findFirstNonDigit(text);
167:                return pos == -1 ? text : text.substring(pos);
168:            }
169:
170:            /**
171:             * Returns the index of the first non-digit character in the given String.
172:             * Non-digit characters are anything other than 0-9, or a leading '-'.
173:             *
174:             * @param text The String to search.
175:             * @return The index of the first non-digit character, or -1 if the String
176:             *         contains only digits (or is empty).
177:             */
178:            public static int findFirstNonDigit(String text) {
179:                for (int pos = 0; pos < text.length(); ++pos) {
180:                    char ch = text.charAt(pos);
181:                    if (!Character.isDigit(ch) && (pos != 0 || ch != '-'))
182:                        return pos;
183:                }
184:
185:                return -1;
186:            }
187:
188:            /**
189:             * Changes the final directory of the path to be that of the argument
190:             *
191:             * @param basePath[in] the base path (e.g. C:\Temp\Bar\)
192:             * @param replacement[in] the string to append (e.g. Foo)
193:             *
194:             * @return the path (e.g. C:\Temp\Foo)
195:             */
196:            public static String changeFinalDirectory(String loc,
197:                    String replacement) {
198:                String retLoc = "";
199:
200:                File floc = new File(loc);
201:                floc = floc.getParentFile();
202:                if (floc != null)
203:                    retLoc = new File(floc, replacement).toString();
204:                else
205:                    retLoc = replacement;
206:
207:                //      Unportable code:
208:
209:                //		String[] strs = loc.split("\\");
210:                //		if (strs != null && strs.length > 0)
211:                //		{
212:                //			int size = strs.length;
213:                //			for(int i=0; i<size; i++)
214:                //			{
215:                //				if (size > i + 2)
216:                //				{
217:                //					if (retLoc.length() > 0)
218:                //					{
219:                //						retLoc += "\\";
220:                //					}
221:                //					retLoc += strs[i];
222:                //				}
223:                //			}
224:                //		}
225:                //		retLoc += replacement;
226:                return retLoc;
227:            }
228:
229:            /**
230:             * This method takes toSplice and for every delimiter in it, replaces that delimiter
231:             * with value, returning the results in result.
232:             *
233:             * @param toSplice the string to parse
234:             * @param delimiter the delimiter to replace
235:             * @param value the value that is replacing every occurrence of delimiter
236:             * @return The resultant string after substitutions.
237:             */
238:            public static String splice(String toSplice, String delimiter,
239:                    String value) {
240:                //String[] strs = toSplice.split(delimiter);
241:                StringTokenizer tokenizer = new StringTokenizer(toSplice,
242:                        delimiter);
243:                return join(tokenizer, value);
244:            }
245:
246:            public static String join(String[] strs, String value) {
247:                String retStr = "";
248:                if (strs != null) {
249:                    int size = strs.length;
250:                    for (int i = 0; i < size; i++) {
251:                        if (size == i + 1) {
252:                            retStr += strs[i];
253:                        } else {
254:                            retStr += strs[i];
255:                            retStr += value;
256:                        }
257:                    }
258:                }
259:                return retStr;
260:            }
261:
262:            public static String join(StringTokenizer tokens, String value) {
263:                // String concatnation is suppose to be really slow.  StringBuffer
264:                // appends are suppose to be faster.
265:                StringBuffer retStr = new StringBuffer("");
266:                if (tokens != null) {
267:                    while (tokens.hasMoreTokens() == true) {
268:                        retStr.append(tokens.nextToken());
269:                        if (tokens.hasMoreTokens() == true) {
270:                            retStr.append(value);
271:                        }
272:                    }
273:                }
274:                return retStr.toString();
275:            }
276:
277:            /**
278:             * Retrieves the parent directory of the given file.
279:             * @param file An absolute file name.
280:             * @return The parent directory, or the <code>""</code> if we can't work out
281:             *         what the parent directory is (for instance, if <code>file</code>
282:             *         is <code>null</code>). If the directory name is not empty, it is
283:             *         guaranteed to end with the filename separator character.
284:             */
285:            public static String getPath(String file) {
286:                String path = "";
287:                if (file != null && file.length() > 0) {
288:                    path = new File(file).getParent();
289:                    if (path == null)
290:                        path = "";
291:                }
292:
293:                if (path != null && path.length() > 0
294:                        && !path.endsWith(File.separator))
295:                    path += File.separator;
296:                return path;
297:            }
298:
299:            /**
300:             * Returns the name of the file or directory.  Neiter path nor
301:             * the extention is used.  You can use the File class to perform
302:             * the same action.  However that requires a File object to be
303:             * created first.
304:             *
305:             * @param file The full path to the file or directory.
306:             * @return The file name.
307:             * @see java.io.File#getName
308:             */
309:            public static String getFileName(String file) {
310:                String name = "";
311:                if (file != null && file.length() > 0) {
312:                    name = new File(file).getName();
313:                    int dotPos = name.lastIndexOf('.');
314:                    if (dotPos >= 0) {
315:                        name = name.substring(0, dotPos);
316:                    }
317:                }
318:                return name;
319:            }
320:
321:            /**
322:             * @param thepath
323:             * @param thefile
324:             * @param string
325:             * @return
326:             */
327:            public static String createFullPath(String thepath, String thefile,
328:                    String ext) {
329:                String path = thepath;
330:                if (thefile != null && thefile.length() > 0) {
331:                    int pos = thefile.indexOf('.');
332:                    if (pos >= 0) {
333:                        path += thefile.subSequence(0, pos) + ext;
334:                    } else {
335:                        if ((thefile.startsWith(File.separator) == false)
336:                                && (path.endsWith(File.separator) == false)) {
337:                            path += File.separator;
338:                        }
339:                        path += thefile + ext;
340:                    }
341:                }
342:                return path;
343:            }
344:
345:            /**
346:             *
347:             * Replaces all occurrences of the strToReplace substring in str with the passed in string
348:             * in replaceWith. For example, "File %1 was saved.  Please copy %1 to a safe place"
349:             * Use this method to replace the %1 with another string.
350:             *
351:             * @param str[in] The string that will be searched.
352:             * @param strToReplace[in] The sub string in str to replace
353:             * @param replaceWith[in] The string to replace the sub string with.
354:             *
355:             * @return The modified string.
356:             *
357:             */
358:            public static String replaceAllSubstrings(String str,
359:                    String strToReplace, String replaceWith) {
360:                StringBuffer buffer = new StringBuffer(str);
361:                //replacedStr = replacedStr.replaceAll(strToReplace, replaceWith);
362:
363:                if (strToReplace.length() > 0) {
364:                    int pos = buffer.indexOf(strToReplace);
365:                    while (pos >= 0) {
366:                        buffer.replace(pos, pos + strToReplace.length(),
367:                                replaceWith);
368:
369:                        pos = buffer.indexOf(strToReplace, pos
370:                                + replaceWith.length());
371:                    }
372:                }
373:
374:                return buffer.toString();
375:            }
376:
377:            /**
378:             *
379:             * Replaces the strToReplace substring in str with the passed in string in replaceWith. For example,
380:             * "File %1 was saved." Use this method to replace the %1 with another string.
381:             *
382:             * @param str[in] The string that will be searched.
383:             * @param strToReplace[in] The sub string in str to replace
384:             * @param replaceWith[in] The string to replace the sub string with.
385:             *
386:             * @return The modified string.
387:             *
388:             */
389:            public static String replaceSubString(String str,
390:                    String strToReplace, String replaceWith) {
391:                //String replacedStr = str;
392:                //replacedStr = replacedStr.replaceFirst(strToReplace, replaceWith);
393:                StringBuffer buffer = new StringBuffer(str);
394:                int pos = buffer.indexOf(strToReplace);
395:                if (pos >= 0) {
396:                    buffer.replace(pos, pos + strToReplace.length(),
397:                            replaceWith);
398:                }
399:
400:                return buffer.toString();
401:            }
402:
403:            public static boolean hasExtension(String fullFileName,
404:                    String extension) {
405:                boolean retVal = false;
406:
407:                int pos = fullFileName.lastIndexOf('.');
408:                if (pos > 0) {
409:                    // First check with out the dot in the extension.  If the check
410:                    // fails then check with the dot in the extension.
411:                    String ext = fullFileName.substring(pos + 1);
412:                    retVal = ext.toLowerCase().equals(extension.toLowerCase());
413:
414:                    if (retVal == false) {
415:                        ext = fullFileName.substring(pos);
416:                        retVal = ext.toLowerCase().equals(
417:                                extension.toLowerCase());
418:                    }
419:                }
420:
421:                return retVal;
422:            }
423:
424:            /**
425:             * Returns the argument filename with the argument extension
426:             *
427:             * @param fullFilename The full path to the file
428:             * @param extension The extension for the file
429:             * @return The full filename for the file with the indicated extension
430:             */
431:            public static String ensureExtension(String filename, String ext) {
432:                String retVal = "";
433:
434:                int index = filename.lastIndexOf('.');
435:                if (index > 0) {
436:                    retVal = filename.substring(0, index);
437:                } else {
438:                    retVal = filename;
439:                }
440:                retVal += ext;
441:                return retVal;
442:            }
443:
444:            /**
445:             * Splits the given text into substrings around the given delimiter, and
446:             * adds each substring to the given Collection.
447:             *
448:             * @param text The string to split.
449:             * @param out  The Collection to populate with substrings.
450:             * @param delimiter The delimiter to use for splitting. If
451:             *                  <code>null</code>, the default delimiter is assumed.
452:             * @return The number of substrings found.
453:             */
454:            public static ETList<String> splitOnDelimiter(String text,
455:                    String delimiter) {
456:                ETList<String> retStrs = new ETArrayList<String>();
457:                StringTokenizer tok = delimiter != null ? new StringTokenizer(
458:                        text, delimiter) : new StringTokenizer(text);
459:
460:                while (tok.hasMoreTokens()) {
461:                    retStrs.add(tok.nextToken());
462:                }
463:                return retStrs;
464:            }
465:
466:            /**
467:             * Retrieves the extension of the passed in filename.
468:             *
469:             * @param fullFileName The file coming in. Can be relative or absolute.
470:             *
471:             * @return The extension, else "" if no extension found. The
472:             *         returned extension will NOT contain the '.'
473:             */
474:            public static String getExtension(String filename) {
475:                String ext = "";
476:                int pos = filename.lastIndexOf(".");
477:                if (pos >= 0) {
478:                    ext = filename.substring(pos + 1);
479:                }
480:                return ext;
481:            }
482:
483:            /*
484:             * Searches through a string for the first character that matches any element of a specified string.
485:             *
486:             * @param str The string for which the member function is to search.
487:             *
488:             * @return The index of the first character of the substring searched for when successful; otherwise -1
489:             */
490:            public static int findFirstOf(final String strThis, final String str) {
491:                return findFirstOf(strThis, str, 0);
492:            }
493:
494:            /*
495:             * Searches for the first occurrence of any of the chars in str within strThis.
496:             *
497:             * @param str The string containing chars to find in strThis.
498:             * @param off Index of the position in strThis at which the search is to begin.
499:             *
500:             * @return The index of the first character of the substring searched for when successful; otherwise -1
501:             */
502:            public static int findFirstOf(final String strThis,
503:                    final String str, int off) {
504:                int iFirstOf = -1;
505:
506:                for (int iPos = off; iPos < strThis.length(); iPos++) {
507:                    int iTest = str.indexOf(strThis.charAt(iPos));
508:                    if (iTest != -1) {
509:                        iFirstOf = iPos;
510:                        break;
511:                    }
512:                }
513:
514:                return iFirstOf;
515:            }
516:
517:            public static String timeToString(long T, int prec) {
518:                if ((prec < 0) || (prec > 3))
519:                    prec = 3;
520:                long ts = T / 1000; // total seconds
521:                long ms = T % 1000; // milliseconds
522:                long h = 0;
523:                if (ts >= 360000) {
524:                    h = ts / 3600;
525:                    ts = ts % 3600;
526:                }
527:                long m = 0;
528:                if (ts >= 6000) {
529:                    m = ts / 60;
530:                    ts = ts % 60;
531:                }
532:                StringBuffer B = new StringBuffer();
533:                if (h > 0) {
534:                    B.append(String.valueOf(h));
535:                    B.append("h ");
536:                }
537:                if (m > 0) {
538:                    B.append(String.valueOf(m));
539:                    B.append("m ");
540:                }
541:                B.append(String.valueOf(ts));
542:                if (prec == 0) {
543:                    B.append("s");
544:                    return B.toString();
545:                }
546:                B.append(".");
547:                switch (prec) {
548:                case 1:
549:                    B.append(String.valueOf(ms / 100));
550:                    break;
551:                case 2:
552:                    B.append(String.valueOf(ms / 10));
553:                    break;
554:                case 3:
555:                    B.append(String.valueOf(ms));
556:                    break;
557:                }
558:                B.append("s");
559:                return B.toString();
560:            }
561:
562:            public static String unescapeHTML(String html) {
563:                StringBuffer retVal = new StringBuffer();
564:                PushbackReader reader = new PushbackReader(new StringReader(
565:                        html), 20);
566:                try {
567:                    int ch = reader.read();
568:                    while (ch != -1) {
569:                        if (ch == '&') {
570:                            int newCh = getEscapeCode(reader);
571:                            while (newCh != -1) {
572:                                ch = -1;
573:                                if (newCh == '&') {
574:                                    newCh = getEscapeCode(reader);
575:                                    if (newCh == -1) {
576:                                        retVal.append('&');
577:                                    } else if (newCh == '&') {
578:                                        // Now handle the case where more than one amper
579:                                        // appears in a row.
580:                                        retVal.append('&');
581:
582:                                    }
583:                                } else {
584:                                    retVal.append((char) newCh);
585:                                    newCh = getEscapeCode(reader);
586:                                }
587:                            }
588:
589:                            // If a second escape did not appear, then we need to add the
590:                            // amper;
591:                            if (ch != -1) {
592:                                retVal.append('&');
593:                            }
594:                        } else {
595:                            retVal.append((char) ch);
596:                        }
597:
598:                        ch = reader.read();
599:                    }
600:
601:                    return retVal.toString();
602:                }
603:
604:                catch (IOException ex) {
605:                    Log.impossible(ex.getMessage());
606:                    return html;
607:                }
608:            }
609:
610:            private static int getEscapeCode(final PushbackReader reader)
611:                    throws IOException {
612:                int ch = -1;
613:
614:                StringBuffer escapeString = new StringBuffer();
615:                int escapeChar = reader.read();
616:                while ((escapeChar != ';') && (escapeChar != -1)) {
617:                    if ((escapeChar == '&') || (escapeString.length() >= 10)) {
618:                        escapeString.append((char) escapeChar);
619:                        escapeChar = -1;
620:                        break;
621:                    }
622:
623:                    escapeString.append((char) escapeChar);
624:                    escapeChar = reader.read();
625:                }
626:
627:                if (escapeChar != -1) {
628:                    ch = escapeStrings.get(escapeString.toString());
629:                } else {
630:                    if (escapeString.length() > 0) {
631:                        char[] buffer = new char[escapeString.length()];
632:                        escapeString.getChars(0, buffer.length, buffer, 0);
633:                        //                reader.unread(buffer, 0, buffer.length);
634:                        reader.unread(buffer);
635:                    }
636:                }
637:                return ch;
638:            }
639:
640:            private static Map<String, Integer> escapeStrings = new HashMap<String, Integer>();
641:
642:            static {
643:                escapeStrings.put("quot", 34);
644:                escapeStrings.put("amp", 38);
645:                escapeStrings.put("lt", 60);
646:                escapeStrings.put("gt", 62);
647:                escapeStrings.put("nbsp", 160);
648:                escapeStrings.put("iexcl", 161);
649:                escapeStrings.put("cent", 162);
650:                escapeStrings.put("pound", 163);
651:                escapeStrings.put("curren", 164);
652:                escapeStrings.put("yen", 165);
653:                escapeStrings.put("brvbar", 166);
654:                escapeStrings.put("sect", 167);
655:                escapeStrings.put("uml", 168);
656:                escapeStrings.put("copy", 169);
657:                escapeStrings.put("ordf", 170);
658:                escapeStrings.put("laquo", 171);
659:                escapeStrings.put("not", 172);
660:                escapeStrings.put("shy", 173);
661:                escapeStrings.put("reg", 174);
662:                escapeStrings.put("macr", 175);
663:                escapeStrings.put("deg", 176);
664:                escapeStrings.put("plusmn", 177);
665:                escapeStrings.put("sup2", 178);
666:                escapeStrings.put("sup3", 179);
667:                escapeStrings.put("acute", 180);
668:                escapeStrings.put("micro", 181);
669:                escapeStrings.put("para", 182);
670:                escapeStrings.put("middot", 183);
671:                escapeStrings.put("cedil", 184);
672:                escapeStrings.put("sup1", 185);
673:                escapeStrings.put("ordm", 186);
674:                escapeStrings.put("raquo", 187);
675:                escapeStrings.put("frac14", 188);
676:                escapeStrings.put("frac12", 189);
677:                escapeStrings.put("frac34", 190);
678:                escapeStrings.put("iquest", 191);
679:                escapeStrings.put("Agrave", 192);
680:                escapeStrings.put("Aacute", 193);
681:                escapeStrings.put("Acirc", 194);
682:                escapeStrings.put("Atilde", 195);
683:                escapeStrings.put("Auml", 196);
684:                escapeStrings.put("Aring", 197);
685:                escapeStrings.put("AElig", 198);
686:                escapeStrings.put("Ccedil", 199);
687:                escapeStrings.put("Egrave", 200);
688:                escapeStrings.put("Eacute", 201);
689:                escapeStrings.put("Ecirc", 202);
690:                escapeStrings.put("Euml", 203);
691:                escapeStrings.put("Igrave", 204);
692:                escapeStrings.put("Iacute", 205);
693:                escapeStrings.put("Icirc", 206);
694:                escapeStrings.put("Iuml", 207);
695:                escapeStrings.put("ETH", 208);
696:                escapeStrings.put("Ntilde", 209);
697:                escapeStrings.put("Ograve", 210);
698:                escapeStrings.put("Oacute", 211);
699:                escapeStrings.put("Ocirc", 212);
700:                escapeStrings.put("Otilde", 213);
701:                escapeStrings.put("Ouml", 214);
702:                escapeStrings.put("times", 215);
703:                escapeStrings.put("Oslash", 216);
704:                escapeStrings.put("Ugrave", 217);
705:                escapeStrings.put("Uacute", 218);
706:                escapeStrings.put("Ucirc", 219);
707:                escapeStrings.put("Uuml", 220);
708:                escapeStrings.put("Yacute", 221);
709:                escapeStrings.put("THORN", 222);
710:                escapeStrings.put("szlig", 223);
711:                escapeStrings.put("agrave", 224);
712:                escapeStrings.put("aacute", 225);
713:                escapeStrings.put("acirc", 226);
714:                escapeStrings.put("atilde", 227);
715:                escapeStrings.put("auml", 228);
716:                escapeStrings.put("aring", 229);
717:                escapeStrings.put("aelig", 230);
718:                escapeStrings.put("ccedil", 231);
719:                escapeStrings.put("egrave", 232);
720:                escapeStrings.put("eacute", 233);
721:                escapeStrings.put("ecirc", 234);
722:                escapeStrings.put("euml", 235);
723:                escapeStrings.put("igrave", 236);
724:                escapeStrings.put("iacute", 237);
725:                escapeStrings.put("icirc", 238);
726:                escapeStrings.put("iuml", 239);
727:                escapeStrings.put("eth", 240);
728:                escapeStrings.put("ntilde", 241);
729:                escapeStrings.put("ograve", 242);
730:                escapeStrings.put("oacute", 243);
731:                escapeStrings.put("ocirc", 244);
732:                escapeStrings.put("otilde", 245);
733:                escapeStrings.put("ouml", 246);
734:                escapeStrings.put("divide", 247);
735:                escapeStrings.put("oslash", 248);
736:                escapeStrings.put("ugrave", 249);
737:                escapeStrings.put("uacute", 250);
738:                escapeStrings.put("ucirc", 251);
739:                escapeStrings.put("uuml", 252);
740:                escapeStrings.put("yacute", 253);
741:                escapeStrings.put("thorn", 254);
742:                escapeStrings.put("yuml", 255);
743:                escapeStrings.put("OElig", 338);
744:                escapeStrings.put("oelig", 339);
745:                escapeStrings.put("Scaron", 352);
746:                escapeStrings.put("scaron", 353);
747:                escapeStrings.put("Yuml", 376);
748:                escapeStrings.put("fnof", 402);
749:                escapeStrings.put("circ", 710);
750:                escapeStrings.put("tilde", 732);
751:                escapeStrings.put("Alpha", 913);
752:                escapeStrings.put("Beta", 914);
753:                escapeStrings.put("Gamma", 915);
754:                escapeStrings.put("Delta", 916);
755:                escapeStrings.put("Epsilon", 917);
756:                escapeStrings.put("Zeta", 918);
757:                escapeStrings.put("Eta", 919);
758:                escapeStrings.put("Theta", 920);
759:                escapeStrings.put("Iota", 921);
760:                escapeStrings.put("Kappa", 922);
761:                escapeStrings.put("Lambda", 923);
762:                escapeStrings.put("Mu", 924);
763:                escapeStrings.put("Nu", 925);
764:                escapeStrings.put("Xi", 926);
765:                escapeStrings.put("Omicron", 927);
766:                escapeStrings.put("Pi", 928);
767:                escapeStrings.put("Rho", 929);
768:                escapeStrings.put("Sigma", 931);
769:                escapeStrings.put("Tau", 932);
770:                escapeStrings.put("Upsilon", 933);
771:                escapeStrings.put("Phi", 934);
772:                escapeStrings.put("Chi", 935);
773:                escapeStrings.put("Psi", 936);
774:                escapeStrings.put("Omega", 937);
775:                escapeStrings.put("alpha", 945);
776:                escapeStrings.put("beta", 946);
777:                escapeStrings.put("gamma", 947);
778:                escapeStrings.put("delta", 948);
779:                escapeStrings.put("epsilon", 949);
780:                escapeStrings.put("zeta", 950);
781:                escapeStrings.put("eta", 951);
782:                escapeStrings.put("theta", 952);
783:                escapeStrings.put("iota", 953);
784:                escapeStrings.put("kappa", 954);
785:                escapeStrings.put("lambda", 955);
786:                escapeStrings.put("mu", 956);
787:                escapeStrings.put("nu", 957);
788:                escapeStrings.put("xi", 958);
789:                escapeStrings.put("omicron", 959);
790:                escapeStrings.put("pi", 960);
791:                escapeStrings.put("rho", 961);
792:                escapeStrings.put("sigmaf", 962);
793:                escapeStrings.put("sigma", 963);
794:                escapeStrings.put("tau", 964);
795:                escapeStrings.put("upsilon", 965);
796:                escapeStrings.put("phi", 966);
797:                escapeStrings.put("chi", 967);
798:                escapeStrings.put("psi", 968);
799:                escapeStrings.put("omega", 969);
800:                escapeStrings.put("thetasym", 977);
801:                escapeStrings.put("upsih", 978);
802:                escapeStrings.put("piv", 982);
803:                escapeStrings.put("ensp", 8194);
804:                escapeStrings.put("emsp", 8195);
805:                escapeStrings.put("thinsp", 8201);
806:                escapeStrings.put("zwnj", 8204);
807:                escapeStrings.put("zwj", 8205);
808:                escapeStrings.put("lrm", 8206);
809:                escapeStrings.put("rlm", 8207);
810:                escapeStrings.put("ndash", 8211);
811:                escapeStrings.put("mdash", 8212);
812:                escapeStrings.put("lsquo", 8216);
813:                escapeStrings.put("rsquo", 8217);
814:                escapeStrings.put("sbquo", 8218);
815:                escapeStrings.put("ldquo", 8220);
816:                escapeStrings.put("rdquo", 8221);
817:                escapeStrings.put("bdquo", 8222);
818:                escapeStrings.put("dagger", 8224);
819:                escapeStrings.put("Dagger", 8225);
820:                escapeStrings.put("permil", 8240);
821:                escapeStrings.put("lsaquo", 8249);
822:                escapeStrings.put("rsaquo", 8250);
823:                escapeStrings.put("bull", 8226);
824:                escapeStrings.put("hellip", 8230);
825:                escapeStrings.put("prime", 8242);
826:                escapeStrings.put("Prime", 8243);
827:                escapeStrings.put("oline", 8254);
828:                escapeStrings.put("frasl", 8260);
829:                escapeStrings.put("image", 8465);
830:                escapeStrings.put("weierp", 8472);
831:                escapeStrings.put("real", 8476);
832:                escapeStrings.put("trade", 8482);
833:                escapeStrings.put("alefsym", 8501);
834:                escapeStrings.put("larr", 8592);
835:                escapeStrings.put("uarr", 8593);
836:                escapeStrings.put("rarr", 8594);
837:                escapeStrings.put("darr", 8595);
838:                escapeStrings.put("harr", 8596);
839:                escapeStrings.put("crarr", 8629);
840:                escapeStrings.put("lArr", 8656);
841:                escapeStrings.put("uArr", 8657);
842:                escapeStrings.put("rArr", 8658);
843:                escapeStrings.put("dArr", 8659);
844:                escapeStrings.put("hArr", 8660);
845:                escapeStrings.put("forall", 8704);
846:                escapeStrings.put("part", 8706);
847:                escapeStrings.put("exist", 8707);
848:                escapeStrings.put("empty", 8709);
849:                escapeStrings.put("nabla", 8711);
850:                escapeStrings.put("isin", 8712);
851:                escapeStrings.put("notin", 8713);
852:                escapeStrings.put("ni", 8715);
853:                escapeStrings.put("prod", 8719);
854:                escapeStrings.put("sum", 8721);
855:                escapeStrings.put("minus", 8722);
856:                escapeStrings.put("lowast", 8727);
857:                escapeStrings.put("radic", 8730);
858:                escapeStrings.put("prop", 8733);
859:                escapeStrings.put("infin", 8734);
860:                escapeStrings.put("ang", 8736);
861:                escapeStrings.put("and", 8743);
862:                escapeStrings.put("or", 8744);
863:                escapeStrings.put("cap", 8745);
864:                escapeStrings.put("cup", 8746);
865:                escapeStrings.put("int", 8747);
866:                escapeStrings.put("there4", 8756);
867:                escapeStrings.put("sim", 8764);
868:                escapeStrings.put("cong", 8773);
869:                escapeStrings.put("asymp", 8776);
870:                escapeStrings.put("ne", 8800);
871:                escapeStrings.put("equiv", 8801);
872:                escapeStrings.put("le", 8804);
873:                escapeStrings.put("ge", 8805);
874:                escapeStrings.put("sub", 8834);
875:                escapeStrings.put("sup", 8835);
876:                escapeStrings.put("nsub", 8836);
877:                escapeStrings.put("sube", 8838);
878:                escapeStrings.put("supe", 8839);
879:                escapeStrings.put("oplus", 8853);
880:                escapeStrings.put("otimes", 8855);
881:                escapeStrings.put("perp", 8869);
882:                escapeStrings.put("sdot", 8901);
883:                escapeStrings.put("lceil", 8968);
884:                escapeStrings.put("rceil", 8969);
885:                escapeStrings.put("lfloor", 8970);
886:                escapeStrings.put("rfloor", 8971);
887:                escapeStrings.put("lang", 9001);
888:                escapeStrings.put("rang", 9002);
889:                escapeStrings.put("loz", 9674);
890:                escapeStrings.put("spades", 9824);
891:                escapeStrings.put("clubs", 9827);
892:                escapeStrings.put("hearts", 9829);
893:                escapeStrings.put("diams", 9830);
894:            }
895:
896:        }
w__w_w.j__a___v___a2___s__._co_m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.