Class Sed

java.lang.Object
com.nefrock.edgeocr.Sed

public class Sed extends Object
sedライクなテキスト変換機能を提供するクラスです。 文字列内のパターンを検索し、置換を行います。
  • Constructor Details

    • Sed

      public Sed()
  • Method Details

    • transform

      public static String transform(String input, String pattern, String replacement)
      文字列変換を実行します(リテラルパターン)。
      Parameters:
      input - 変換対象の文字列
      pattern - 検索するパターン(リテラル文字列)
      replacement - 置換文字列
      Returns:
      変換後の文字列。エラーが発生した場合はnull
    • transform

      public static String transform(String input, String pattern, String replacement, boolean useRegex)
      文字列変換を実行します。
      Parameters:
      input - 変換対象の文字列
      pattern - 検索するパターン
      replacement - 置換文字列
      useRegex - trueの場合、patternを正規表現として扱います。falseの場合、リテラル文字列として扱います。
      Returns:
      変換後の文字列。エラーが発生した場合はnull
    • transformRegex

      public static String transformRegex(String input, String regex, String replacement)
      文字列変換を実行します(正規表現パターン)。
      Parameters:
      input - 変換対象の文字列
      regex - 検索する正規表現パターン
      replacement - 置換文字列
      Returns:
      変換後の文字列。エラーが発生した場合はnull