roman: use stringBuild for better performance(?)
This commit is contained in:
parent
5f93a0b843
commit
accb2c51dc
@ -1,11 +1,13 @@
|
|||||||
package roman
|
package roman
|
||||||
|
|
||||||
|
import "strings"
|
||||||
|
|
||||||
func ConvertToRoman(arabic int) string {
|
func ConvertToRoman(arabic int) string {
|
||||||
var converted string
|
var converted strings.Builder
|
||||||
if arabic <= 3 {
|
if arabic <= 3 {
|
||||||
for i := 0; i < arabic; i++ {
|
for i := 0; i < arabic; i++ {
|
||||||
converted += "I"
|
converted.WriteString("I")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return converted
|
return converted.String()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user