jw_cad 外部変形 - (1155) javaで文字を逆書きする -

外部変形は データのやり取りをテキストファイルで行うので プログラム言語は 自由に選ぶことができます。図形は機能的かつシンプルなため、数多くのユーザーに受け入れられています。

 

javaで文字を逆書きする

:javaで文字を逆書きする

@echo off
if not exist %~dp0Jreverse.class (
  for /f "delims=:" %%n in ('findstr /n "^#!" %0') do (
    more +%%n %0 > %~dpn0.java
    javac -encoding shift_jis %~dpn0.java
  )
)
copy jwc_temp.txt myfiles > nul
java -Dfile.encoding=shift_jis -classpath %~dp0 Jreverse > jwc_temp.txt
goto:eof

REM #jww
REM #h3 範囲内の「文字」データのみを選択
REM #g1
REM #e

#!この次の行からプログラムを書いてください
import java.io.*;
import java.util.regex.Pattern;

class Jreverse {
  public static void main(String args) {
    try {
      BufferedReader f = new BufferedReader(new FileReader("myfiles"));
      String line;
      while ( (line = f.readLine()) != null) {
        if (Pattern.compile("^hq").matcher(line).find()) {
          System.out.println("hd");
        }
        if (Pattern.compile("^lg|^ly|^cn").matcher(line).find()) {
          System.out.println(line);
        }
        if (Pattern.compile("^c[hvsroptkz2]").matcher(line).find()) {
          String
s = line.split("\"");
          StringBuffer sb = new StringBuffer(s[1]);
          System.out.println(s[0] + "\"" + sb.reverse());
        }
      }
      f.close();
    } catch (IOException e) {
      System.out.println(e);
    }
  }
}