Example usage for com.google.common.base Splitter on

List of usage examples for com.google.common.base Splitter on

Introduction

In this page you can find the example usage for com.google.common.base Splitter on.

Prototype

@CheckReturnValue
@GwtIncompatible("java.util.regex")
public static Splitter on(final Pattern separatorPattern) 

Source Link

Document

Returns a splitter that considers any subsequence matching pattern to be a separator.

Usage

From source file:org.apache.isis.applib.util.Enums.java

public static String getEnumNameFromFriendly(String anEnumFriendlyName) {
    return Joiner.on("_").join(Iterables.transform(Splitter.on(" ").split(anEnumFriendlyName), UPPER_CASE));
}

From source file:net.oneandone.neo.datareplicator.utils.Utils.java

public static ImmutableMap<String, String> toMap(String content) {
    return ImmutableMap.copyOf(Splitter.on("\n").trimResults().withKeyValueSeparator("=").split(content));
}

From source file:org.robotframework.ide.eclipse.main.plugin.project.library.RobotToHtmlConverter.java

public String convert(final String robotStyleString) {
    final List<String> splitted1 = Splitter.on('\n').splitToList(robotStyleString);
    final List<String> wrapped = Lists.transform(splitted1, new Function<String, String>() {
        @Override/*from w w w .j  av a 2 s.c o  m*/
        public String apply(final String line) {
            final String escaped = escapeGtLtAmp(line);
            return wrapLineIntoTags(escaped);
        }
    });
    final String consecutiveParagraphsJoined = Joiner.on('\n').join(joinPargraphsToLists(wrapped))
            .replaceAll("</p>\n<p>", "\n");

    final List<String> splitted2 = Splitter.on('\n').splitToList(consecutiveParagraphsJoined);
    final List<String> spansWrappedIntoParagraphs = Lists.transform(splitted2, new Function<String, String>() {
        @Override
        public String apply(final String line) {
            return isSpan(line) ? "<p>" + line + "</p>" : line;
        }
    });
    return Joiner.on('\n').join(spansWrappedIntoParagraphs);
}

From source file:com.lithium.flow.matcher.StringMatchers.java

@Nonnull
public static StringMatcher fromConfig(@Nonnull Config config, @Nonnull String key) {
    checkNotNull(config);/*  w  ww.  j a  v  a2s .c o  m*/
    checkNotNull(key);
    return fromList(config.getList(key, Splitter.on(' ')));
}

From source file:com.google.caliper.runner.target.EffectiveClassPath.java

static String getClassPathForClassLoader(ClassLoader classLoader) {
    // Order of JAR files may have some significance. Try to preserve it.
    LinkedHashSet<File> files = new LinkedHashSet<File>();
    for (String entry : Splitter.on(PATH_SEPARATOR).split(JAVA_CLASS_PATH)) {
        files.add(new File(entry));
    }// w  w  w .  jav  a 2  s.c o  m
    files.addAll(getClassPathFiles(classLoader));

    return Joiner.on(PATH_SEPARATOR).join(files);
}

From source file:nl.socrates.dom.utils.StringUtils.java

public static String enumTitle(final String string) {
    if (string == null) {
        return null;
    }/* w  w  w .  j  a v  a  2 s  . c  o m*/
    return Joiner.on(" ").join(Iterables.transform(Splitter.on("_").split(string), LOWER_CASE_THEN_CAPITALIZE));
}

From source file:com.dangdang.ddframe.job.cloud.state.UniqueJob.java

/**
 * ????.//from   w ww . j  av a  2s. c  o m
 * 
 * @param uniqueName ??
 * @return UUID??
 */
public static UniqueJob from(final String uniqueName) {
    List<String> target = Splitter.on(DELIMITER).splitToList(uniqueName);
    return new UniqueJob(target.get(0), target.get(1));
}

From source file:com.android.tools.idea.gradle.structure.quickfix.QuickFixes.java

public static void executeQuickFix(@NotNull String quickFix, @NonNls PsContext context) {
    List<String> segments = Splitter.on(QUICK_FIX_PATH_SEPARATOR).splitToList(quickFix);
    assert !segments.isEmpty();

    String action = segments.get(0);
    if (SET_LIBRARY_DEPENDENCY_QUICK_FIX.equals(action)) {
        assert segments.size() == 4;
        String moduleName = segments.get(1);
        String dependency = segments.get(2);
        String version = segments.get(3);
        setLibraryDependencyVersion(context, moduleName, dependency, version);
    }//from ww  w  . ja v  a2 s .c  om
}

From source file:com.google.api.codegen.util.java.JavaRenderingUtil.java

/**
 * Splits given text into lines and returns an list of strings, each one representing a line.
 * Performs escaping of certain html characters.
 *///from ww w  .j a v  a 2  s.c o  m
public static List<String> getDocLines(String text) {
    // TODO: convert markdown to javadoc
    // https://github.com/googleapis/toolkit/issues/331
    List<String> result = new ArrayList<>();
    text = JAVADOC_ESCAPER.escape(text);
    for (String line : Splitter.on(String.format("%n")).split(text)) {
        result.add(line);
    }
    return result;
}

From source file:org.jclouds.aliyun.ecs.compute.functions.internal.OperatingSystems.java

private static String parseVersion(Image image) {
    String sequence = image.osName().trim().replaceAll("\\s+", " ");
    int offset = 2;
    if (isWindows(image)) {
        sequence = image.platform();//from  w w w.  j a  v  a2s  . com
        offset = 1;
    }
    Iterable<String> splitted = Splitter.on(" ").split(sequence);
    return Iterables.get(splitted, Iterables.size(splitted) - offset);
}