「kotlin」RegExクラスのサンプル
使用例
fun main() { val cft = Regex("RT") println("result1: "+"RBT".matches(cft)); println("result2: "+"RZT".matches( ...「Kotlin」正規表現で先頭の文字列を指定する
サンプルコード
fun main() { val str = Regex("^ST.") println("STC".matches(str)); println("SZC".matches(str));}結果
t ...
「Kotlin入門」ラムダ式のサンプル
書式
val 変数名:(Int,Int) -> Int =(表現式)
使用例
「Kotlin」createFile()で空ファイルを作成するサンプル
書式
Files.createFile(ファイルパス)
使用例
「Kotlin」move()メソッドでフォルダを移動するサンプル
書式
public static Path move(Path source,Path target,CopyOption… options)throws IOException
使用例
「Kotlin」copy()でフォルダをコピーするサンプル
書式
public static Path copy(Path source,Path target,CopyOption… options) throws IOException
使用例
「Kotlin」exists()でフォルダの存在を確認するサンプル
書式
public static boolean exists(Path path,LinkOption… options)
public static boolean notExists(Path pat ...
「Kotlin入門」join()メソッドで指定文字列を結合するサンプル
書式
public static String join(CharSequence delimiter, CharSequence… elements)
使用例
「Kotlin」StringBuilderのappend()メソッドでint,string,char文字列を結合するサンプル
書式
fun append(value: Char): StringBuilder
fun append(value: String): StringBuilder
fun append(value: Int) ...
「Kotlin入門」sorted()でListの要素をソートする方法
書式
listOf(xxx).sorted()
使用例
「Kotlin」@GetMappingアノテーションのheaders、paramsオプションのサンプル
構文
@GetMapping(“xxx”,params=)
使用例1 paramsオプション
「Kotlin」@CookieValueアノテーションを使うサンプル
使用例
@GetMapping(“/login”)
fun handle(@CookieValue(“JSESSIONID”) cookie: String) {
「Kotlin」メディア・タイプ(consumable)を受け入れるサンプル
構文
@PostMapping(“xxx”, consumes = )
サンプルコード
[Kotlin] @PostMappingと@GetMappingのサンプル
構文
@GetMapping(“/{パラメータ名}”)
fun 関数名(@PathVariable 関数: 型)
サンプルコード
「Kotlin入門」@Controllerアノテーションのサンプル
構文
@Controller
class クラス名
サンプルコード