fun addStrNums( num1: String,  num2: String):String {

    var isNum1 = true
    var isNum2 = true

    isNum1 = num1.matches("-?\\d+(\\.\\d+)?".toRegex())
	isNum2 = num2.matches("-?\\d+(\\.\\d+)?".toRegex())
    if (isNum1 && isNum2){
        var n1 = num1.toInt()
        var n2 = num2.toInt()
        return "${n1+n2}"
    else return "not Number"
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter