KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > help > internal > base > util > LinkUtil


1 /*******************************************************************************
2  * Copyright (c) 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11  
12 package org.eclipse.help.internal.base.util;
13  
14
15 public class LinkUtil {
16
17     /*
18      * Strings any parameters off the given href. If there is an anchor reference
19      * after the parameters it will be maintained. If null is passed in, null is returned.
20      */

21     public static String JavaDoc stripParams(String JavaDoc href) {
22         if (href == null)
23             return null;
24         int index = href.indexOf('?');
25         if (index != -1) {
26             String JavaDoc param = href.substring(index);
27             href = href.substring(0, index);
28             if ((index = param.indexOf('#')) != -1)
29                 href = href + param.substring(index);
30         }
31         return href;
32     }
33 }
34
Popular Tags