roman: use stringBuild for better performance(?)

This commit is contained in:
vinchent 2024-09-22 20:54:22 +02:00
parent 5f93a0b843
commit accb2c51dc

View File

@ -1,11 +1,13 @@
package roman
import "strings"
func ConvertToRoman(arabic int) string {
var converted string
var converted strings.Builder
if arabic <= 3 {
for i := 0; i < arabic; i++ {
converted += "I"
converted.WriteString("I")
}
}
return converted
return converted.String()
}