Created
March 18, 2024 12:19
-
-
Save Dinoy-Raj/9e2087b3d0a2b620d37be37dc65e8c6a to your computer and use it in GitHub Desktop.
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
@RequiresApi(Build.VERSION_CODES.TIRAMISU) | |
fun List<String?>?.formatter(type: ListFormatter.Type, width: Width): String { | |
var formattedValue = "" | |
try { | |
ListFormatter.getInstance() | |
val formatter = ListFormatter.getInstance(Locale.getDefault(), type, width) | |
formattedValue = formatter.format(this) | |
} catch (e: Exception) { | |
Log.d("ListFormatter", "error in formatting list") | |
} | |
return formattedValue | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment