Jump to content

Python Little Convertion Function


Recommended Posts

Hi metin2dev today i wanna release a little function to convert in the easyest way number in pointed number string.

 

Ex:

 

From :150000000

 

In : 150.000.000

 

 

 

It's very usefull if you need to create a  new coins manage interface like that:

 

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

 

Here the full commented code:

def splittedvalue(value):
	x = value
	x_list = list(x) #convert string in list
	
	x_list.reverse() #reverse list for the right point 

	if len(x)%3 == 0:   #checking how many point must insert.If there is not rest,  point -1 to avoid .100.500
	   count_point = len(x)/3-1
	else:
		count_point = len(x)/3 
		
	for point in range(0,count_point):  #insert the points in the right place
		x_list.insert((3*int(point+1)+point),".")

	x_list.reverse()  #reverse again the list as begining
	x_list = "".join(x_list) #reconvert list in string
	return x_list  #finally return string value with point

Reguards Luzzo

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 1
Link to comment
Share on other sites

  • 1 year later...

Announcements



  • Similar Content

  • Similar Content

  • Similar Content

  • Tags

  • Activity

    1. 3

      Crystal Metinstone

    2. 3

      Feeding game source to LLM

    3. 113

      Ulthar SF V2 (TMP4 Base)

    4. 3

      Feeding game source to LLM

    5. 0

      Target Information System

    6. 3

      Feeding game source to LLM

    7. 2

      anti exp explanation pls

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.