Created
July 22, 2017 22:15
-
-
Save ViRb3/6711ada617eb03cfc2feb4f45a168da4 to your computer and use it in GitHub Desktop.
Convert to CStyle Array Kotlin
This file contains 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
fun ConvertToCStyleArray(text: String): String { | |
var result = "" | |
var singleByte = "" | |
for(i in text) | |
{ | |
singleByte += i | |
if(singleByte.length > 1) { | |
result += "\\x" + singleByte | |
singleByte = "" | |
} | |
} | |
return result | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment