Created
April 25, 2012 05:10
-
-
Save hatone/2486641 to your computer and use it in GitHub Desktop.
溜め込んだサムシング
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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