Skip to content

Instantly share code, notes, and snippets.

View ron623's full-sized avatar

h.shino ron623

  • jp
View GitHub Profile
c:\slack>set token=xoxb-33030529412-yZJDFkFnGpH3CvzvFoyEgEzx
c:\slack>node bot.js
module.js:338
throw err;
^
Error: Cannot find module 'c:\slack\bot.js'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Function.Module.runMain (module.js:501:10)
@ron623
ron623 / Serializable
Created June 5, 2015 03:35
Serializable
package transient_test;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
// transient修飾子を指定したフィールドが直列化されないことを証明するためのクラス
@ron623
ron623 / substring
Created March 23, 2015 08:54
substring
/**
*この文字列の部分文字列である新しい文字列を返します。部分文字列は、指定された beginIndex から始まり、
*インデックス endIndex - 1 にある文字までです。したがって、部分文字列の長さは endIndex-beginIndex になります。
*/
public String substring(int beginIndex, int endIndex) {
return ((beginIndex == 0) && (endIndex == count)) ? this :
new String(offset + beginIndex, endIndex - beginIndex, value);
@ron623
ron623 / trim
Created March 23, 2015 08:48
trim
public String trim() {
int len = count; // 文字数(終了インデックス)
int st = 0; // 開始インデックス
int off = offset; // 最初のインデックス
char[] val = value; // String文字列
// Stringオブジェクトの長さが0より大きく、(最初のindex+0)番目の文字がスペースより小さい場合
while ((st < len) && (val[off + st] <= ' ')) {
// indexを1つずらし、次の文字をチェック。。
// スペースじゃなくなるまで行う
@ron623
ron623 / no4
Created March 19, 2015 09:46
no4
public class No4 {
/*
* 文字列のコピーを返します。先頭と最後の空白は省略されます。
* この String オブジェクトが空の文字列を表す場合、あるいはこの
* Stringオブジェクトによって表される 文字列の最初と最後の文字のコードが '\u0020' (スペース文字) より大きい場合は、この
* String オブジェクトへの参照が返されます。
*
* 文字列内に '\u0020' より大きいコードの文字がない場合は、空の文字列を表す新しい String オブジェクトが生成されて返されます。
*
* たとえば、k が文字列内の最初の文字のインデックスであり、「 」より大きいコード値を持ち、 m
@ron623
ron623 / NestCls
Last active April 4, 2016 09:18
NestCls
package Nest;
public class NestCls {
// 非staticメンバ
int i = 0;
// staticなメンバ
static int a = 999;
// インナークラス(非static)
@ron623
ron623 / nest
Created March 14, 2015 00:20
nest
package Nest;
public class NestCls {
// 非staticメンバ
int i = 0;
// staticなメンバ
static int a = 999;
// インナークラス(非static)
@ron623
ron623 / sitch_error
Created March 8, 2015 04:48
sitch_error
package test;
public class Test {
static Integer num;
public static void main(String[] args) {
switch (num) {
case 0:
@ron623
ron623 / switch
Created March 8, 2015 04:44
switch
package test;
public class Test {
static int num;
public static void main(String[] args) {
switch (num) {
case 0:
@ron623
ron623 / no5
Created March 7, 2015 04:02
no5
package study_03;
public class No5 {
/*
* 指定されたindexから始まる部分文字列の先頭から始まるかどうかテストする
*
* このオブジェクトの部分文字列のときはtrue,そうでなければfalse
* tooffsetが負の値である場合、あるいはStringオブジェクトの長さよりも長い場合false そうでない場合は結果は次の式の結果と同じ
* this.subString(toffset).startsWith(prefix)