This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
function getRequest() { | |
var a = null; | |
if (window.XMLHttpRequest) { | |
try { | |
a = new XMLHttpRequest; | |
} | |
catch(c) { | |
} | |
} else if (window.ActiveXObject) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final String stringToSplit = "dave:123, john:314,, matt:989"; | |
final Map<String, String> splitKeyValues = Splitter.on(",") | |
.omitEmptyStrings() | |
.trimResults() | |
.withKeyValueSeparator(":") | |
.split(stringToSplit); | |
// Map Contents: {dave=123, john=314, matt=989} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final String stringToSplit = "dave,john,matt"; | |
final Iterable<String> result = Splitter.on(",").split(stringToSplit); | |
// Result: ["dave", "john", "matt"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final String stringToSplit = "dave ,john,, matt"; | |
final Iterable<String> result = Splitter.on(",") | |
.omitEmptyStrings() | |
.trimResults() | |
.split(stringToSplit); | |
// Result: ["dave", "john", "matt"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final Map<String, String> resultMap = new HashMap<String, String>(); | |
for (String val: "dave:123, john:314,, matt:989".split(",")) { | |
if (val != null && ! "".equals(val.trim())) { | |
final String[] keyValue = val.split(":"); | |
resultMap.put(keyValue[0].trim(), keyValue[1].trim()); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final Map<String, String> input = new HashMap<String, String>() {{ | |
put("param", "v"); | |
put("p2", "v2"); | |
put("q", "java"); | |
}}; | |
final String result = Joiner.on("&") | |
.withKeyValueSeparator("=") | |
.join(input); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final String[] input = new String[] {"dave", "john", "dan", "matt"}; | |
final String result = Joiner.on(",") | |
.join(input); | |
// "dave,john,dan,matt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final String[] input = new String[] {"dave", "john", | |
null, "dan", null, "matt"}; | |
final String resultSkip = Joiner.on(",") | |
.skipNulls() | |
.join(input); | |
// resultSkip = "dave,john,dan,matt" | |
final String resultUseForNull = Joiner.on(",") | |
.useForNull("<blank>") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final Joiner joiner = Joiner.on(",") | |
.skipNulls(); | |
StringBuilder builder = new StringBuilder(); | |
final String[] input1 = new String[] {"dave", "john"}; | |
builder = joiner.appendTo(builder, input1); | |
// Dave and John have a comma between them. | |
final String[] input2 = new String[]{null, "dan"}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="gallery-image1" | |
data-date="August 14th, 2011" | |
data-location="Austin, TX" | |
data-author-name="Dave">Gallery Image 1</div> |
OlderNewer