Convert English numbers in a String to Arabic numbers

iTurki

I have multiple strings with different formats that I need to display in some TextViews. I have no control over the length or the format of these strings. They could have numbers obly, text only, or a combination of both.

My goal is to display the strings in some TextViews, and in the process, convert any English numbers to Arabic numbers.

The following examples should clarify what I mean:

original string   >> converted string
=====================================
test 123          >> test ١٢٣
test              >> test
123               >> ١٢٣

I started by doing this:

txtView.setText(String.format(locale, "%d", fulltext));

but this assumes you have numbers only in your fulltext string.

Could you suggest how to work around this?

Andrew Brooke

Lets say your fulltext string is this

String fulltext = "1a2b3c";

Replace the instances of all of the numbers with the corresponding Arabic numbers

fulltext = fulltext.replace("1","١").replace("2","٢").replace("3","٣");

etc. Hopefully this is what you mean

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

How to convert Persian/Arabic numbers to English numbers in Kotlin?

From Dev

java program convert numbers to string

From Dev

UITextview shows text Arabic but numbers English

From Dev

Convert Arabic numbers to words with javascript

From Dev

How to convert normal numbers into arabic numbers in django

From Dev

Use arabic letters with arabic numbers

From Dev

Sql convert string of numbers to int

From Dev

How to convert english numbers inside a string to Persian/Arabic numbers in Objective-C?

From Dev

How to convert a string of numbers into an array?

From Dev

How to convert Persian and Arabic digits of a string to English using JavaScript?

From Dev

Convert English numbers in a String to Arabic numbers

From Dev

Convert the numbers of a set to String

From Dev

Convert English numbers to Persian/Arabic only for a specified div

From Dev

How use arabic letters with english letters and numbers in regular expression

From Dev

Convert Arabic String to english number in Swift

From Dev

Convert numbers in string to English word format

From Dev

Convert/encode string to numbers

From Dev

Convert numbers to English strings

From Dev

How to convert a string of numbers to an array

From Dev

Sql convert string of numbers to int

From Dev

Java convert string to array of numbers

From Dev

Convert the numbers of a set to String

From Dev

Want to match all non numbers is Arabic and English

From Dev

Switch Arabic Numbers To English In String

From Dev

how to convert a string of numbers to a char

From Dev

How to convert numbers in a string, into a hash

From Dev

Regular expression for Arabic, and English Numbers, with country code as well

From Dev

Javascript: Convert numbers inside the string

From Dev

Convert a string that contains numbers to a vector of numbers

Related Related

  1. 1

    How to convert Persian/Arabic numbers to English numbers in Kotlin?

  2. 2

    java program convert numbers to string

  3. 3

    UITextview shows text Arabic but numbers English

  4. 4

    Convert Arabic numbers to words with javascript

  5. 5

    How to convert normal numbers into arabic numbers in django

  6. 6

    Use arabic letters with arabic numbers

  7. 7

    Sql convert string of numbers to int

  8. 8

    How to convert english numbers inside a string to Persian/Arabic numbers in Objective-C?

  9. 9

    How to convert a string of numbers into an array?

  10. 10

    How to convert Persian and Arabic digits of a string to English using JavaScript?

  11. 11

    Convert English numbers in a String to Arabic numbers

  12. 12

    Convert the numbers of a set to String

  13. 13

    Convert English numbers to Persian/Arabic only for a specified div

  14. 14

    How use arabic letters with english letters and numbers in regular expression

  15. 15

    Convert Arabic String to english number in Swift

  16. 16

    Convert numbers in string to English word format

  17. 17

    Convert/encode string to numbers

  18. 18

    Convert numbers to English strings

  19. 19

    How to convert a string of numbers to an array

  20. 20

    Sql convert string of numbers to int

  21. 21

    Java convert string to array of numbers

  22. 22

    Convert the numbers of a set to String

  23. 23

    Want to match all non numbers is Arabic and English

  24. 24

    Switch Arabic Numbers To English In String

  25. 25

    how to convert a string of numbers to a char

  26. 26

    How to convert numbers in a string, into a hash

  27. 27

    Regular expression for Arabic, and English Numbers, with country code as well

  28. 28

    Javascript: Convert numbers inside the string

  29. 29

    Convert a string that contains numbers to a vector of numbers

HotTag

Archive