This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.InetAddress | |
import java.util.Random | |
fun random(): String { | |
val randomChars = CharArray(8) | |
var count = 0 | |
val random = Random() | |
while (count < 8) { | |
val randomAscii = random.nextInt(122) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.example.assignment1 | |
val trimRegex = """[^().\d-+*/]""".toRegex() | |
val parenthesesRegex = """\((-?[.\d]+)([/*+-])(-?[.\d]+)\)""".toRegex() | |
val expressionRegex = """(-?[.\d]+)([/*+-])(-?[.\d]+)""" | |
.toRegex() | |
val multiplyAndDivideRegex = """([.\d]+)([*/])([.\d]+)""" | |
.toRegex() | |
fun trim(v: String): String { |