Sign in to follow this  
Followers 0
blinko2008

StringFormat Help

2 posts in this topic

I'm having some trouble while using the StringFormat.

visual Basic for example is as easy as

Dim nValue as String

nValue = 10000

Text1.text = Format("###,###", nValue)

Where the text in Text1 would become 10,000 instead of 10000 all together.

However the StringFormat isn't working as i was hoping it would.

any ideas would greatly be appreciated.

Greetz Blinko

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi!

Maybe something like this?

MsgBox(0,"10000",_Format("###,###",",",10000))

; Author monoceres
Func _Format($pattern,$delimiter,$number)
    $number=String($number)
    Local $answer
    $array=StringSPlit($pattern,$delimiter)
    For $i=Ubound($array)-1 To 1 Step -1
        $count=StringLen($array[$i])
        $answer=StringRight($number,$count)&$delimiter&$answer
        $number=StringTrimRight($number,$count)
        If StringLen($number)=0 Then ExitLoop
    Next
    $answer=StringTrimRight($answer,1)
    If StringLen($number)>0 Then
        $answer=$number&$answer
    EndIf
    return $answer
EndFunc

:)

Edited by monoceres

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0