Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.tools;
|
---|
3 |
|
---|
4 | /**
|
---|
5 | * Text/String utils.
|
---|
6 | * @since 13978
|
---|
7 | */
|
---|
8 | public final class TextUtils {
|
---|
9 |
|
---|
10 | private TextUtils() {
|
---|
11 | // Hide default constructor for utils classes
|
---|
12 | }
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * Inserts zero width space character (U+8203) after each slash/ampersand to wrap long URLs.
|
---|
16 | * @param url URL
|
---|
17 | * @return wrapped URL
|
---|
18 | * @since 13978
|
---|
19 | */
|
---|
20 | public static String wrapLongUrl(String url) {
|
---|
21 | return url.replace("/", "/\u200b").replace("&", "&\u200b");
|
---|
22 | }
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * Remove privacy related parts from output URL
|
---|
26 | * @param url Unmodified URL
|
---|
27 | * @return Stripped URL (privacy related issues removed)
|
---|
28 | * @since 18652
|
---|
29 | */
|
---|
30 | public static String stripUrl(String url) {
|
---|
31 | return url.replaceAll("(token|key|connectId)=[^&]+", "$1=...stripped...");
|
---|
32 | }
|
---|
33 |
|
---|
34 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.