Skip to content

Commit

Permalink
Update Main.kt (#3)
Browse files Browse the repository at this point in the history
* refactor Main.kt to improve readability

* refactor Main.kt to improve readability

* change spacing
  • Loading branch information
wiryadev authored Jul 13, 2021
1 parent fd7944c commit 1a67b5b
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/test/kotlin/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@ import java.io.File

fun main() {
val iconTest = File("raw-icons4")
val src = File("build/generated-icons").apply { mkdirs()}
val src = File("build/generated-icons").apply { mkdirs() }

Svg2Compose.parse(
"br.com.compose.icons",
"EvaIcons",
src,
iconTest,
iconNameTransformer = { name, group -> name.removeSuffix(group, ignoreCase = true) }
applicationIconPackage = "br.com.compose.icons",
accessorName = "EvaIcons",
outputSourceDirectory = src,
vectorsDirectory = iconTest,
iconNameTransformer = { name, group ->
name.removeSuffix(group, ignoreCase = true)
}
)
}

private fun String.removeSuffix(suffix: String, ignoreCase: Boolean): String {
if(ignoreCase) {
return if (ignoreCase) {
val index = lastIndexOf(suffix, ignoreCase = true)

return if(index > -1) substring(0, index) else this
if (index > -1) substring(0, index) else this
} else {
return removeSuffix(suffix)
removeSuffix(suffix)
}
}

0 comments on commit 1a67b5b

Please sign in to comment.