![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Format numbers... Hi Do Until objRecordSet.EOF GuyFile.Write (objRecordSet.Fields(0).Value) GuyFile.Write (" ") GuyFile.Write (objRecordSet.Fields(1).Value) GuyFile.Write (" ") GuyFile.Write (objRecordSet.Fields(2).Value) GuyFile.Write (" ") GuyFile.Write (objRecordSet.Fields(3).Value) GuyFile.Write (" ") GuyFile.Writeline (objRecordSet.Fields(4).Value) objRecordSet.MoveNext Loop With this code the result is: 722 45 127 45 67 985 13 1432 67 And i need: 722 45 127 45 67 985 13 1432 67 Is possible to format the number and write correct? Thenkyou ins advance H. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Format numbers... Henrique schrieb: Quote: > Hi > > > Do Until objRecordSet.EOF > GuyFile.Write (objRecordSet.Fields(0).Value) > GuyFile.Write (" ") > GuyFile.Write (objRecordSet.Fields(1).Value) > GuyFile.Write (" ") > GuyFile.Write (objRecordSet.Fields(2).Value) > GuyFile.Write (" ") > GuyFile.Write (objRecordSet.Fields(3).Value) > GuyFile.Write (" ") > GuyFile.Writeline (objRecordSet.Fields(4).Value) > > objRecordSet.MoveNext > Loop > > With this code the result is: > > 722 45 127 > 45 67 985 > 13 1432 67 > > And i need: > > 722 45 127 > 45 67 985 > 13 1432 67 > > Is possible to format the number and write correct? I'm not sure about your sample/desired output, but maybe this Quote: Quote: >> Const cnMxL = 10 >> WScript.Echo Right( Space( cnMxL ) & 1234567890, cnMxL ) >> WScript.Echo Right( Space( cnMxL ) & 1, cnMxL ) >> WScript.Echo Right( Space( cnMxL ) & 12, cnMxL ) >> 1 12 will get you started. |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Format numbers... In microsoft.public.scripting.vbscript message <48ff0b89$0$14062$9b4e6d9 3@xxxxxx-online.net>, Wed, 22 Oct 2008 13:16:26, ekkehard.horner <ekkehard.horner@xxxxxx> posted: Quote: > >I'm not sure about your sample/desired output, but maybe this > Quote: Quote: >>> Const cnMxL = 10 >>> WScript.Echo Right( Space( cnMxL ) & 1234567890, cnMxL ) >>> WScript.Echo Right( Space( cnMxL ) & 1, cnMxL ) >>> WScript.Echo Right( Space( cnMxL ) & 12, cnMxL ) function Widen(X, L) Widen = Space(L-Len(X)) & X end function but it needs adjustment if it is to handle "insufficient room" better. -- (c) John Stockton, nr London UK. ?@merlyn.demon.co.uk IE7 FF2 Op9 Sf3 news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>. <URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources. <URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links. |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Format numbers... I generally include a Pad function which looks like Function Pad ( num , width ) Pad = Right(Space(width)&num,width) End Function Then when you want to print the numbers you can specify the field width Do Until objRecordSet.EOF for i = 0 to 4 GuyFile.Write Pad(objRecordSet.Fields(i).Value,6) next GuyFile.WriteLine objRecordSet.MoveNext Loop |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Format numbers... Thanks For all "Henrique" <wq@xxxxxx> escreveu na mensagem news:newscache$rtt49k$i8e$1@xxxxxx Quote: > Hi > > > Do Until objRecordSet.EOF > GuyFile.Write (objRecordSet.Fields(0).Value) > GuyFile.Write (" ") > GuyFile.Write (objRecordSet.Fields(1).Value) > GuyFile.Write (" ") > GuyFile.Write (objRecordSet.Fields(2).Value) > GuyFile.Write (" ") > GuyFile.Write (objRecordSet.Fields(3).Value) > GuyFile.Write (" ") > GuyFile.Writeline (objRecordSet.Fields(4).Value) > > objRecordSet.MoveNext > Loop > > With this code the result is: > > 722 45 127 > 45 67 985 > 13 1432 67 > > And i need: > > 722 45 127 > 45 67 985 > 13 1432 67 > > Is possible to format the number and write correct? > > Thenkyou ins advance > > H. > > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| convert fax numbers to canonical format | Vista print fax & scan | |||
| -f format Format-Table Format-List against Select | PowerShell | |||
| Windows Mail format bar doesn't format color, size, justification | Browsers & Mail | |||
| Converting date time format to string format | PowerShell | |||
| Help! DVD format error: "Windows was unable to complete the format | Vista General | |||