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
#my code | |
prof = {:name => ["静岡 太郎","名古屋 次郎","大津 三郎"], :age => ["34歳","25歳","19歳"], :addres => ["静岡県","愛知県","滋賀県"]} | |
pattern = hogehoge | |
def search(pattern) | |
if /#{pattern}/ =~ prof | |
puts("パターンにマッチした") | |
end | |
end | |
=begin |
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
#I wrote | |
sum = 0 | |
i = 1 | |
while i == 100 do | |
sum += i | |
i += 1 | |
puts sum | |
end | |
=begin |
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
print("foo\nbar\nbaz") |
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
// http://www.javadrive.jp/start/string/index6.htmlからコピペ | |
class Connect{ // JSample6_1 | |
public static void main(String args[]){ | |
String str1 = "パトカー"; // 腕時計からパトカーに改変 | |
String str2 = "タクシー"; // 追加 | |
int i,j; | |
/*for (i = 0,j = 0; i < str1.length(); i++,j++){ | |
char c1 = str1.charAt(i); | |
char c2 = str2.charAt(j); |
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
// http://www.javadrive.jp/start/string/index5.htmlからコピペ | |
class CharAt{ //JSample5_1をCharAtに改変 | |
public static void main(String args[]){ | |
String str = "パタトクカシーー"; //腕時計をパタトクカシーーに改変 | |
char c1 = str.charAt(0); | |
char c3 = str.charAt(2); | |
char c5 = str.charAt(4); | |
char c7 = str.charAt(6); //一つ追加 | |
// http://www.techscore.com/blog/2012/11/29/%E6%96%87%E5%AD%97%E5%88%97%E7%B5%90%E5%90%88-java%E7%B7%A8/からコピペ改変 |
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
//http://simplesandsamples.com/reverse.java.htmlからコピペ | |
import java.io.*; | |
import java.util.*; | |
class ReverseString{ //TestをReverseStringに改変 | |
public static void main(String[] args) { | |
String src = "stressed"; | |
StringBuffer sb = new StringBuffer(src); | |
String dst = sb.reverse().toString(); | |
System.out.println(""+dst); | |
} |