package cn.sagacloud.server.algorithm.test

import org.junit.Test
import java.lang.StringBuilder
import kotlin.random.Random

/**
 *
 *
 * @author jxing
 */
class StringBuilderTest {

    @Test
    fun range(){
        val sb = StringBuilder()
        sb.append("123456,")
    }

    @Test
    fun random(){
        val rand = Random(99L)
        var times = rand.nextInt(0, 0)
        println(times)
    }

    @Test
    fun split(){
        var list = arrayListOf("F1M1", "F1", "B1", "B2M1")
        list.forEach {
            var arr = it.split("F|M|B".toRegex())
            println("size : ${arr.size} : ")
            arr.forEach{
                println(it)
            }
        }
    }
    @Test
    fun split1(){
        val str = "1+2-3+5-64*25+25/65"
        val array = str.split("\\+|-|\\*|/".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
        print(array)
    }

    @Test
    fun float(){
        System.out.println(0.05+0.01);
//        System.out.println(1.0-0.42);
//        System.out.println(4.015*100);
//        System.out.println(123.3/100);
        System.out.println(0.7+0.1);
    }
}