Skip to content

Instantly share code, notes, and snippets.

@hatone
Created April 25, 2012 05:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hatone/2486641 to your computer and use it in GitHub Desktop.
Save hatone/2486641 to your computer and use it in GitHub Desktop.
溜め込んだサムシング
import java.util.regex.*;
public class Calc {
public static void main(String[] args) {
char[] charArray;
charArray = new char[10];
charArray[0] = '1';
charArray[1] = '2';
charArray[2] = '3';
charArray[3] = '4';
String str =String.valueOf(charArray);
String str2 = "1234567";
// System.out.println(str2.indexOf(String.valueOf(charArray[4]) ));
// System.out.println(str);
String str1 = "123a";
String regex1 = "a";
Pattern p = Pattern.compile(regex1);
Matcher m = p.matcher(str1);
System.out.println("文字列"+str1);
System.out.println("パターン"+regex1);
if(m.find()){
System.out.println("マッチしました!");
}
else{
System.out.println("マッチしません。");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment