How do I Make it Short Replace Method ?

Not favoritedFavorited Favorited 1 favourites
  • 5 posts
From the Asset Store
Sync animations, animation frames, mirror state, sounds and anything else using these methods.
  • How can i make it short

    level is global variable (number)

    "स्तर - " &

    Replace(

    Replace(

    Replace(

    Replace(

    Replace(

    Replace(

    Replace(

    Replace(

    Replace(

    Replace(str(level), "0", "०"),

    "1", "१"),

    "2", "२"),

    "3", "३"),

    "4", "४"),

    "5", "५"),

    "6", "६"),

    "7", "७"),

    "8", "८"),

    "9", "९")

    and what i do when levels more than hundreds. . .

  • I have no clue if numbers in Hindi are a compound of the numbers from 0 to 9.

    with mid(string,index,length)

    mid(Num,int(mid(input,loopindex("x"),1)),1)

    This is a nested mid. The inner is looping through the input and makes an Integer out of every character in the input string. And this is used as an index for the Num String.

  • i thought that was long code by compare my code in single line

    also that code needs to be make 3 Global Variables and some events. . .

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • No, you don't need the variables or the events if you only have level 0 to 9.

    That whole example was only to show you how it works.

    That is what you can use to replace your code:

    mid("०१२३४५६७८९",int(level),1)

    If you want more than Level 0 to 9 you need a loop.

  • Here's for 0 to 99

    mid(" १२३४५६७८९",int(level/10)%10,1)&mid("०१२३४५६७८९",level%10,1)

    or this

    (level>9?mid("०१२३४५६७८९",int(level/10)%10,1):"")&mid("०१२३४५६७८९",level%10,1)

    And 0 to 999

    (level>99?mid("०१२३४५६७८९",int(level/100)%10,1):"")&(level>9?mid("०१२३४५६७८९",int(level/10)%10,1):"")&mid("०१२३४५६७८९",level%10,1)

    or 0 to 9999

    (level>999?mid("०१२३४५६७८९",int(level/1000)%10,1):"")&(level>99?mid("०१२३४५६७८९",int(level/100)%10,1):"")&(level>9?mid("०१२३४५६७८९",int(level/10)%10,1):"")&mid("०१२३४५६७८९",level%10,1)

Jump to:
Active Users
There are 0 visitors browsing this topic (0 users and 0 guests)