Tabnine Logo
String.replaceAll
Code IndexAdd Tabnine to your IDE (free)

How to use
replaceAll
method
in
java.lang.String

Best Java code snippets using java.lang.String.replaceAll (Showing top 20 results out of 102,393)

origin: libgdx/libgdx

public AssetDescriptor (String fileName, Class<T> assetType, AssetLoaderParameters<T> params) {
  this.fileName = fileName.replaceAll("\\\\", "/");
  this.type = assetType;
  this.params = params;
}
origin: libgdx/libgdx

public AssetDescriptor (String fileName, Class<T> assetType, AssetLoaderParameters<T> params) {
  this.fileName = fileName.replaceAll("\\\\", "/");
  this.type = assetType;
  this.params = params;
}
origin: stackoverflow.com

 static String splitCamelCase(String s) {
  return s.replaceAll(
   String.format("%s|%s|%s",
     "(?<=[A-Z])(?=[A-Z][a-z])",
     "(?<=[^A-Z])(?=[A-Z])",
     "(?<=[A-Za-z])(?=[^A-Za-z])"
   ),
   " "
  );
}
origin: shuzheng/zheng

/**
 * 驼峰转下划线(简单写法,效率低于{@link #humpToLine(String)})
 * @param str
 * @return
 */
public static String humpToLine2(String str) {
  return str.replaceAll("[A-Z]", "_$0").toLowerCase();
}
origin: netty/netty

private static String normalize(String value) {
  return value.toLowerCase(Locale.US).replaceAll("[^a-z0-9]+", "");
}
origin: stackoverflow.com

String[] tests = {
   "  x  ",          // [x]
   "  1   2   3  ",  // [1 2 3]
   "",               // []
   "   ",            // []
 };
 for (String test : tests) {
   System.out.format("[%s]%n",
     test.replaceAll("^ +| +$|( )+", "$1")
   );
 }
origin: alibaba/druid

public void output(StringBuffer buf) {
  if ((this.text == null) || (this.text.length() == 0)) {
    buf.append("NULL");
    return;
  }
  buf.append("N'");
  buf.append(this.text.replaceAll("'", "''"));
  buf.append("'");
}
origin: google/guava

 @Override
 public String apply(String value) {
  return value.replaceAll("[\\r\\n]", "");
 }
});
origin: apache/incubator-dubbo

  /**
   * This is used to convert a configuration nodePath into a key
   * TODO doc
   *
   * @param path
   * @return key (nodePath less the config root path)
   */
  private String pathToKey(String path) {
    if (StringUtils.isEmpty(path)) {
      return path;
    }
    return path.replace(rootPath + "/", "").replaceAll("/", ".");
  }
}
origin: apache/incubator-dubbo

  /**
   * This is used to convert a configuration nodePath into a key
   * TODO doc
   *
   * @param path
   * @return key (nodePath less the config root path)
   */
  private String pathToKey(String path) {
    if (StringUtils.isEmpty(path)) {
      return path;
    }
    return path.replace(rootPath + "/", "").replaceAll("/", ".");
  }
}
origin: libgdx/libgdx

/** Creates an AssetDescriptor with an already resolved name. */
public AssetDescriptor (FileHandle file, Class<T> assetType, AssetLoaderParameters<T> params) {
  this.fileName = file.path().replaceAll("\\\\", "/");
  this.file = file;
  this.type = assetType;
  this.params = params;
}
origin: libgdx/libgdx

/** Creates an AssetDescriptor with an already resolved name. */
public AssetDescriptor (FileHandle file, Class<T> assetType, AssetLoaderParameters<T> params) {
  this.fileName = file.path().replaceAll("\\\\", "/");
  this.file = file;
  this.type = assetType;
  this.params = params;
}
origin: Tencent/tinker

private static String sanitizeName(RType rType, AaptResourceCollector resourceCollector, String rawName) {
  String sanitizeName = rawName.replaceAll("[.:]", "_");
  resourceCollector.putSanitizeName(rType, sanitizeName, rawName);
  return sanitizeName;
}
origin: jenkinsci/jenkins

  public String resolve(String name) {
    final String value = original.resolve(name);
    if (value == null) return null;
    // Substitute one backslash with two
    return value.replaceAll("\\\\", "\\\\\\\\");
  }
};
origin: netty/netty

private static boolean isOsx0() {
  String osname = SystemPropertyUtil.get("os.name", "").toLowerCase(Locale.US)
      .replaceAll("[^a-z0-9]+", "");
  boolean osx = osname.startsWith("macosx") || osname.startsWith("osx");
  if (osx) {
    logger.debug("Platform: MacOS");
  }
  return osx;
}
origin: alibaba/druid

protected void printChars(String text) {
  if (text == null) {
    print0(ucase ? "NULL" : "null");
  } else {
    print('\'');
    int index = text.indexOf('\'');
    if (index >= 0) {
      text = text.replaceAll("'", "''");
    }
    print0(text);
    print('\'');
  }
}
origin: libgdx/libgdx

@Override
public TextureAtlas load (AssetManager assetManager, String fileName, FileHandle file, TextureAtlasParameter parameter) {
  for (Page page : data.getPages()) {
    Texture texture = assetManager.get(page.textureFile.path().replaceAll("\\\\", "/"), Texture.class);
    page.texture = texture;
  }
   TextureAtlas atlas = new TextureAtlas(data);
   data = null;
   return atlas;
}
origin: libgdx/libgdx

@Override
public TextureAtlas load (AssetManager assetManager, String fileName, FileHandle file, TextureAtlasParameter parameter) {
  for (Page page : data.getPages()) {
    Texture texture = assetManager.get(page.textureFile.path().replaceAll("\\\\", "/"), Texture.class);
    page.texture = texture;
  }
   TextureAtlas atlas = new TextureAtlas(data);
   data = null;
   return atlas;
}
origin: google/guava

public void testToString() {
 for (String inputName : SOMEWHERE_UNDER_PS) {
  InternetDomainName domain = InternetDomainName.from(inputName);
  /*
   * We would ordinarily use constants for the expected results, but
   * doing it by derivation allows us to reuse the test case definitions
   * used in other tests.
   */
  String expectedName = Ascii.toLowerCase(inputName);
  expectedName = expectedName.replaceAll("[\u3002\uFF0E\uFF61]", ".");
  if (expectedName.endsWith(".")) {
   expectedName = expectedName.substring(0, expectedName.length() - 1);
  }
  assertEquals(expectedName, domain.toString());
 }
}
origin: google/guava

public void testGetKeyMatchesString() {
 for (StandardSystemProperty property : StandardSystemProperty.values()) {
  String fieldName = property.name();
  String expected = Ascii.toLowerCase(fieldName).replaceAll("_", ".");
  assertEquals(expected, property.key());
 }
}
java.langStringreplaceAll

Javadoc

Replaces each substring of this string that matches the given regular expression with the given replacement.

An invocation of this method of the form str.replaceAll(regex, repl) yields exactly the same result as the expression

java.util.regex.Pattern. java.util.regex.Pattern#compile(regex). java.util.regex.Pattern#matcher(java.lang.CharSequence)(str). java.util.regex.Matcher#replaceAll(repl)

Note that backslashes (\) and dollar signs ($) in the replacement string may cause the results to be different than if it were being treated as a literal replacement string; see java.util.regex.Matcher#replaceAll. Use java.util.regex.Matcher#quoteReplacement to suppress the special meaning of these characters, if desired.

Popular methods of String

  • equals
  • length
    Returns the number of characters in this string.
  • substring
    Returns a string containing a subsequence of characters from this string. The returned string shares
  • startsWith
    Compares the specified string to this string, starting at the specified offset, to determine if the
  • format
    Returns a formatted string, using the supplied format and arguments, localized to the given locale.
  • split
    Splits this string using the supplied regularExpression. See Pattern#split(CharSequence,int) for an
  • trim
  • valueOf
    Creates a new string containing the specified characters in the character array. Modifying the chara
  • indexOf
  • endsWith
    Compares the specified string to this string to determine if the specified string is a suffix.
  • toLowerCase
    Converts this string to lower case, using the rules of locale.Most case mappings are unaffected by t
  • contains
    Determines if this String contains the sequence of characters in the CharSequence passed.
  • toLowerCase,
  • contains,
  • getBytes,
  • <init>,
  • equalsIgnoreCase,
  • replace,
  • isEmpty,
  • charAt,
  • hashCode,
  • lastIndexOf

Popular in Java

  • Making http requests using okhttp
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getResourceAsStream (ClassLoader)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • Socket (java.net)
    Provides a client-side TCP socket.
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now