kotlinは任意のクラスに後からメソッドを追加できます。これを拡張関数と呼びます。
fun String.print() {
System.out.println(this)
}
Error detected while processing function <SNR>59_ShowMarks: | |
line 39: | |
E885: Not possible to change sign ShowMark76 | |
Press ENTER or type command to continue |
def quicksort(list): | |
if len(list) <= 1: | |
return list | |
pivot = list[0] | |
left = [] | |
right = [] | |
for val in list[1:len(list)]: | |
if val < pivot: | |
left.append(val) | |
else: |
import math | |
import string | |
class RectangularGrid: | |
def countRectangles(self, width, height): | |
counter = 0 | |
for i in range(1,width+1): | |
for j in range(1,height+1): | |
if i != j: | |
counter += ( (1+ (width-i)) * (( 1 + (height- j))) ) |
import math | |
import string | |
class BinPacking: | |
def minBins(self, tuple_items): | |
items = list(tuple_items) | |
bin_count = 0 | |
while 100 in items and 200 in items: | |
items.remove(100) |
#include <stdio.h> | |
// 1.一番ベーシックな構造体の定義の文法 | |
struct sample1{ | |
float f; | |
}; | |
int main() | |
{ | |
struct sample1 a; |
{ | |
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme", | |
"font_face": "Migu 1M", | |
"font_size": 13, | |
"highlight_modified_tabs": true, | |
"ignored_packages": | |
[ | |
"Emmet", | |
"CoffeeCompile" | |
], |
import java.util.List; | |
import android.content.Context; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.BaseAdapter; | |
public class MainViewListAdapter extends BaseAdapter{ | |
List<MainViewListEntry> entries; |
<?php | |
$id = $_GET['id']; //GETパラメーターを取得 | |
function is_on_service_time($line){ | |
return preg_match("/<FONT\scolor=\"\#0000cc\">\d{2}:<\/FONT>\s<A\shref=\"bin\/\d{5}\.html\">\d{2}<\/A>/xsiu",$line,$item); | |
} | |
$result_array = array(); | |
$url = "http://www.busqr.com/jikoku/01/stop/iku/".$id.".html"; |
<?php | |
$direction = $_GET['direction']; | |
$station = $_GET['station']; | |
$direction_num = $direction == 'up' ? 0 : 1; | |
$station_id = array('shintanabe'=>'00004328','kyotanabe'=>'00001755','imadegawa'=>'00002735','demachiyanagi'=>'00003573','doshishamae'=>'00006957','kodo'=>'00001781'); | |
$station_code = array('shintanabe'=>'近鉄京都線','kyotanabe'=>'片町線','imadegawa'=>'京都市営烏丸線','demachiyanagi'=>'京阪本線',); | |
$url = "http://www.navitime.co.jp/diagram/".$station_id[$station]; | |
header('Content-Type:text/html; charset=UTF-8'); | |
$context = stream_context_create(array( | |
'http' => array( |