Created
March 1, 2023 11:30
-
-
Save BekNaji/2161d120f0cadf7a316f2ad50b022590 to your computer and use it in GitHub Desktop.
pretty bank code in flutter | dart
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
void main() { | |
var item = "12345678911234567891"; | |
print(prettyBankCode(item)); // 1234 5678 9112 3456 7891 | |
} | |
prettyBankCode(item){ | |
if(item != null && item.length == 20){ | |
var code = item.substring(0,4); | |
code = code + ' ' + item.substring(4,8); | |
code = code + ' ' + item.substring(8,12); | |
code = code + ' ' + item.substring(12,16); | |
code = code + ' ' + item.substring(16,20); | |
return code; | |
} | |
return item; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment