Cfscript I'm trying to write Please help :)

I wonder if some one could help with a cfscript I'm trying to write.
A have a number eg
135
4245
1
I want to turn these into a string with length 6 with zeros at the start like so:
000135
004245
000001
thx 4 any ideas

Here's a cfscript along the lines of what you asked for. There's other ways to do it, of course, but I thought this approach would be helpful to you.
<cfscript>
/* takes a string as an argument and adds as many zeroes as it takes to make the string be exactly 6 characters. */
function PadWithZeroes()
var VarToTest = "";
var ValToReturn = "";
var VarLen = 0;
var DesiredVarLen = 6;
if (StructCount(Arguments) EQ 1)
    /* Use Trim(Arguments[1]) only if you do NOT want to add zeroes to one or more empty spaces */
    VarToTest = Trim(Arguments[1]);
    VarLen = Len(VarToTest);
    TimesToLoop = DesiredVarLen - VarLen;
if (TimesToLoop GT 0)
    for (q = 1; q LTE TimesToLoop; q = q + 1)
        VarToTest = "0" & VarToTest;
    ValToReturn = VarToTest;
    return ValToReturn;
else
    return false;
// the rest is for testing/viewing the function etc.
NumberToUse = 4;
if (IsDefined("URL.NumberToUse") AND Len(Trim(URL.NumberToUse)) LTE 6)
    NumberToUse = Trim(URL.NumberToUse);
</cfscript>
<cfoutput>
<br>
NumberToUse=#NumberToUse#
<br>
<br>
PadWithZeroes(NumberToUse) = #PadWithZeroes(NumberToUse)#
<br>
<br>
</cfoutput>

Similar Messages

  • My iPhone 4 no longer appears in iTunes. But it does charge. Tried most tips please help. Email or

    My iPhone 4 no longer appears in iTunes. But it does charge. Tried most tips please help someone!

    Hi there,
    No I didn't. Someone suggested in another thread that my iPod was registering as a disk instead of a device, so if I removed my iPod as a disk on Disk Utility then it would reload etc. and show up in iTunes. Which it didn't, and instead just cleared all my music (16,000 songs).
    So frustrating.
    Hope if you have the same problem you are able to find a better solution!

  • I just bought an airport express. i set it up and was able to be detected by my macbook, but i still cant connect wirelessly. the same goes when i tried my iphone. please help!

    i just bought an airport express. i set it up and was able to be detected by my macbook, but i still cant connect wirelessly. the same goes when i tried my iphone. please help!

    Is the status light green?
    Your Airport device may be in Bridge Mode.
    Airport Utility 6:
    Open Airport Utility, select the Airport Express and click Edit. Navigate to the Network tab and change Router Mode to DHCP and NAT. Then click Update on the bottom right.
    Airport Utility 5:
    Open Airport Utility and click Manual Setup. Navigate to the Internet icon and change Connection Sharing to Share a Public IP Address. Then click Update on the bottom right.

  • I need to get into my iTunes but its asking me from my security questions and I have no clue what it is I have tried everything! Please help

    I just bought a 50 dollar iTunes card but now it's asking for my security questions and I have no clue what those are please help I'm begging

    See Kappy's previous write-up.
      Some Solutions for Resetting Forgotten Security Questions: Apple Support Communities

  • My iMessage wont activate on my new iPhone 5c, I have tried everything. Please Help!

    I have tried everything in all of these discussions and i still cant get my imessage or facetime to activate on my iphone 5c. Please help! I've been trying since Thursday!

    I add to this discuss topic.  I have similar problem and tried everything in Apple Help support for this problem.
    Trying to activate iMessage, and appears "Waiting for activation..." (Esperando activación... in spanish).  In the iMac and iPad an advise window shows saying another device is using the Apple ID.  OK, accept in both devices but in the iPhone 5S still "Waiting activation...".
    I did a reset about all settings, activate iMessage for 1 hour and active again, hard reset, under wifi or 3G/LTE connection, loging out and in again with my Apple account and the problem still there.  "Waiting activation...".
    Solution anyone?
    Thanks!!

  • My I pad will not allow me to delete my Facebook account and I have tried everything. Please Help Me.

    My ipad will not allow me to delete my Facebook account. I went to settings an tried to delete my account will not let me. I even entered my password an it said it was incorrect. I also uninstalled my Facebook app an tried to reinstall it am it still will not log out or let me delete my account. PLEASE HELP ME.

    Can you log into Facebook from Safari (just to make sure you're entering the right password)?

  • I cannot restore my iPhone in iTunes, have tried everything! Please help

    Last night I succesfully connected my iPhone to iTunes, updated to current software and bought a few new songs...all ok. In the iPhone summary it showed my details and serial number of the iPhone.
    Just as it was finishing the updates it said that my iPhone could not be found and needed to be restored as it was in recovery mode, when I clicked on the relevant box it said the iPhone could not be located and there was an error 1611. All the details in my summary now showed n/a.
    My iphone screen is stuck on the 'connect to iTunes' symbol and no amount of holding down the button/home screen will re-set. Cannot turn the phone on or off, have tried recharging with a different plug in...nothing.
    I have done all checks on my pc, re-installed iTunes, DFU...absolutely everything that the internet tells you to do!
    I called Apple and they said it was a hardware issue and would cost between £120 - £200 to repair.
    If anyone has any ideas...please help!
    Thank you
    Jo

    Is your phone jailbroken or illegitimately unlocked? Or better yet running a custom version of iOS?
    And for anyone else who stumbles upon this:
    Error 1611: This error may indicate a hardware issue with your device. Follow the steps in this article. Alsoattempt to restore while connected with a known-good 30-pin Dock Connector cable, computer, and network to isolate this issue to the device. The MAC address being missing or the IMEI being the default value (00 499901 064000 0) can also confirm a hardware issue. Out-of-date or incorrectly configured proxy or security software, such as FoxyProxy, can cause error 1611. To troubleshoot third-party security software, follow these steps.

  • CS5 Photoshop crashes... Have tried everything! Please help!!!

    Hi Guys! I am having big problems. I cannot use Adobe Photoshop (CS5) ....(nor Corel Paintshop Photo Pro x3 "Sorry for mentioning that on here!!! )
    I am running a 1 month old Toshiba Satellite C660-1F1 with Windows 7 Home Premium 64-bit with 2GB RAM Intel Core i3-380m processors 2.53 Ghz / 3rd Level Cache 3MB, 320 GB Hard Disk with Intel Graphics Media Accelerator HD (shared memory up to 761 MB).
    I have tried the full paid-for version and the trial version downloaded from the Adobe site.
    Both programmes (CS5 and Corel PSPx3) installed and can be opened.
    With photoshop when i open it the following message comes up:
           "Photoshop has encountered a problem with the display driver, and has temporarily disabled GPU enhancements. Check the video card manufacturer's website for the latest software. GPU enhancements can be enabled in the performance panel of preferences."
    I can usually perform one or two actions before the programme crashes and a message appears to say that it has stopped working. It will crash straight away if I click on the 'Help' menu and then on 'System Info'. Before it crashes when the buttonbs are still responsive ...if I go to the performance panel in preferences and scroll over 'detected video card' the discription box says:
           "Your system display driver has caused Photoshop to crash. Update or reinstall the driverand check enable OpenGL drawing to retry."
    When I follow these steps it just crashes as usual. I have deleted and reinstalled the drivers.I have deleted and reinstalled the programmes countless times. My drivers are all up-to-date. Both software packages claim to and seem to support 64-bit operating systems with my specs. Both say they support Intel HD Graphics. I do not know what else to do or try. I have even performed a fresh reinstallation of my windows 7 64-bit op system. I was looking to upgrade to 4 GB RAM and then  8GB RAM later but not before i can solve this problem.
    Is there something simple/obvious I am missing or is it most likely faulty hardware / bad graphics card??? Please help!
    Just in case it is relevant .... with Corel Paintshop Photo Pro x3 it installed and opens as usual but will crash the second you try to save something.The cursor remains normal but no buttons, tabs or menus are responsive at all. There is just a ping sound every time I click the mouse / touchpad. i must then use 'end task' in task manager to close it down, although it says the programme is running! (It does not say 'not responding').
    All info / advice / suggestions welcome!!! Thanking you in advance!
    John

    Intel doesn't have the best OpenGL implementation.  Okay, that may be being overly kind.
    Your best bet, especially if you have already loaded their latest driver, is probably to deconfigure OpenGL usage by Photoshop.
    First, try this:
    1.  Edit - Preferences - Performance
    2,  Click the [Advanced Settings...] button
    3.  Set Mode to Basic.
    4.  Uncheck Vertical Sync.
    5.  Close and reopen Photoshop.
    If this still doesn't help, try this:
    1.  Edit - Preferences - Performance.
    2.  Uncheck [ ] Enable OpenGL Drawing.
    3.  Close and reopen Photoshop.
    Good luck.
    -Noel

  • White screen, not syncing with computer- tried holding buttons please help?

    Please help. The screen of my daughters 4th gen ipod has frozen white. Have tried syncing the frozen ipod with computer but it is not recognised. I have treid holding home and sleep button at the same time but no change. Would be prepared to do a reset but the computer cannot recognise it. Have read various other responses to questions and am currently leaving the batteries to drain. None of this is helped by the fact that my daughter is sobbing about it in my ear! Ahhhhh

    Phil, did you have a hard Saturday night?  The ling you provided is for "regular" iPod, not iOS devises,  You link stated:
    "If you have an iPod touch, see iPhone, iPad, or iPod touch: Device not recognized in iTunes for Windows."
    Philly_Phan wrote:
    Have you been here?
    http://support.apple.com/kb/TS1369
    There have been some problems accessing pages on the Apple web site.  If the hyperlink gives you a "We're sorry" message, try again.

  • Trouble processing file in iOS4 update, tried EVERYTHING! PLEASE HELP

    I downloaded iTunes 10.5, I troubleshooted the problem and I've tried everything in the books. When I'm downloading the file, it goes for about 45 minutes without a problem, then when the update reaches the point of "processing file", a screen pops up that says "network connection timed out". Please help, this has been a problem for me for about 3 days now.

    Thanks, Wolf. I did follow those instructions to the letter. However, it
    didn't help a bit.

  • !TRIED EVERYTHING! PLEASE HELP! Lenovo thinkpad twist super slow WIFI connect to home router

    I love my twist i just wish my wifi would work at home!
    It connects and works fine at public places
    At home it takes forever to connect maybe have to try 5 times taking 5-7minutes and it will disconnect sometimes if computer goes black 
    I have : lenovo thinkpad twist s230u with windows 8
    I have a : Broadcom 802.11n Network Adapter
    I have a : Broadcom driver 6.30.59.26
    Troubleshooting that i have already tried: adjusting wifi power settings, downloading lenovo driver 
    PLEASE HELP

    I would try plugging the laptop directly into your cable modem, thus by-passing the router, and check your connection speed.  Next, connect the router to the cable modem and plug the laptop directly into the router by cable. Compare your connection speeds.  If both work fine by cable, then I think your wifi on the home router isn't broadcasting/working.  You say the wifi connects at work/public, which leads me to believe it is not your laptop wifi card.  What is your wifi signal strength from your home network? work? public?

  • Error trying to Deply - Please Help!!

    I'm getting the following error while trying to deploy my
    EJBs using JRun 3.1 on my XP pc.
    Exception: [15:24:29] java.io.IOException: CreateProcess:
    javac -classpath
    c:/JRun/3.1/servers/default/deploy/lib;c:/JRun/3.1/servers/default/deploy/mtrack.jar;lib/ ejipt.jar;.;H:/eclipse/workspace/lib/j2ee.jar;c:/JRun/3.1/lib/ejipt.jar;H:/eclipse/workspa ce/lib/jdom.jar;H:/eclipse/workspace/lib/xerces.jar;H:/eclipse/wor
    kspace/lib/ext/commons-fileupload-1.1.jar;c:/JRun/3.1/servers/lib/ojdbc14.jar;H:/eclipse/w orkspace/lib/mtrack.jar;c:/JRun/3.1/lib/install.jar;c:/JRun/3.1/lib/xt
    .jar;c:/JRun/3.1/lib/jrun.jar;c:/JRun/3.1/lib/jsp.jar;c:/JRun/3.1/lib/jsprt.jar;c:/JRun/3. 1/lib/rhino.jar;c:/JRun/3.1/lib/ssi.jar;c:/JRun/3.1/lib/default_export
    s.jar;c:/JRun/3.1/lib/default_objects.jar;c:/JRun/3.1/lib/ejipt.jar;c:/JRun/3.1/lib/ejipt_ ejbeans.jar;c:/JRun/3.1/lib/ejipt_jms.jar;c:/JRun/3.1/lib/ejipt_tools.
    jar;c:/JRun/3.1/lib/ejipt_client.jar -d
    c:/JRun/3.1/servers/default/deploy/lib
    @c:/JRun/3.1/servers/default/deploy/src/list error=2
    at java.lang.Win32Process.create(Native Method)
    at java.lang.Win32Process.<init>(Unknown Source)
    at java.lang.Runtime.execInternal(Native Method)
    at java.lang.Runtime.exec(Unknown Source)
    at java.lang.Runtime.exec(Unknown Source)
    at java.lang.Runtime.exec(Unknown Source)
    at
    allaire.ejipt.tools.Deploy._compileFiles(allaire/ejipt/tools/Deploy.java:700)
    at
    allaire.ejipt.tools.Deploy.redeployJars(allaire/ejipt/tools/Deploy.java:236)
    at
    allaire.ejipt.tools.Deploy.deployJars(allaire/ejipt/tools/Deploy.java:184)
    at
    allaire.ejipt.tools.Deploy.main(allaire/ejipt/tools/Deploy.java:163)
    Please help!
    Thanks
    Pratim

    "Error writing to file: C:\Program Files\Common Files\Apple\Mobile Device Support\AppleMobileDeviceHelper.exe. Verify that you have access to that directory."
    Most commonly, it's caused by disk or file damage, J.
    Let's first try running a chkdsk over your C drive. There's Windows 7 instructions in the following document. Select both "automatically fix file system errors" and "scan for and attempt recovery of bad sectors" or use chkdsk /r (depending on which way you choose to go about things). You should be prompted to schedule the scan to run on restart. That sort of scan of the C drive should take a long time ... if it quits after a few minutes or seconds, something's interfering with the scan:
    [How to use CHKDSK (Check Disk)|http://www.w7forums.com/use-chkdsk-check-disk-t448.html]
    Does the chkdsk find/repair any damage? If so, try another iTunes install. Does it go through properly this time?

  • Hi i have a ipod touch 4th gen and i left it on charge and it wont turn on today when i tried can someone please help !:(

    hey  umm i tried turning my ipod on today after leaving it on charge and it wont turn on also i plugged it in to my computer and it seems not to be coming up in the itunes store someone please help !

    Also see:
    iOS: Not responding or does not turn on

  • MY DNS servers are so slow, i've tried almost everything please help

    So my internet was a bit slow two weeks ago, so I downloaded namebench which gave me two dns servers that were faster, I updated my network preferences and everything seemed to work fine until a day later where the internet became  wayyy sloower than before, youtube is slow, google chrome, safari etc... things i've tried: deleting history, cache and cookies. I've tried cleaning my computer off unwanted apps ,  I've tried contacting comcast and  I gave them permission and the tech manually took told of my screen and went through terminal trying to flush out the DNS servers, but for a lil bit it gave us a DNS failure code, than  than went back to being waaaay slow. I thought it was a virus or malware so I got Sophos it found one malware that i deleted but things are still slow. All the other computers at my house are fast except mine. I've tried going back to my previous DNS before the namebench assigned ones but it's still slow... so I added open servers 8.8.8.8 and than 8.8.4.4 . and these aren't working either.  so even though my internet is slow I downloaded Maverick today and things are still wayy slow, I have full bar on my wifi please help. thankswhat else to do.

    Adding Open DNS codes to your Network Preferences, should give good results in terms of speed-up* as well as added security, (including anti-phishing and redirects) (Full information about Open DNS is here:   http://www.opendns.com/home-solutions and here:  http://www.opendns.com/technology/opendns-vs-google-public-dns/ )
    and further independent information can be read here:
    http://reviews.cnet.com/8301-13727_7-57338784-263/free-dnscrypt-tool-enhances-ma c-web-security/?tag=mncol;txt
    and here:
    http://www.macworld.com/article/1146064/troubleshootdns.html?t=234
    * as confirmed by: http://lifehacker.com/5835775/google-dns-and-opendns-users-are-getting-a-web-spe ed-boost
    and Apple:
    http://support.apple.com/kb/TS3408?viewlocale=en_US
    but results may vary depending on where you are located.
    Open System Preferences/Network. Double click on your connection type, or select it in the drop-down menu, and in the box marked 'DNS Servers' add the following two numbers:
    208.67.222.222
    208.67.220.220
    (You can also enter them if you click on Advanced and then DNS)
    Sometimes reversing the order of the DNS numbers can be beneficial in cases where there is a long delay before web pages start to load, and then suddenly load at normal speed:
    http://support.apple.com/kb/TS2296

  • Vista problems, tried usual fixes, please help.

    I have Windows Vista with a 1st gen shuffle, 60GB photo and 80GB video. The shuffle and photo work flawlessly with Vista. The video does not finish syncing correctly. The songs all download, but iTunes crashes while finsihing the sync. I then have to completely restart to because iTunes can not be killed. Upon reconnecting the iPod, the status bar shows 45GB of "Other" , actually my songs, but starts a whole new sync. After the crash, only the first few songs, in alphabetically order by artist, are available on the iPod, although it reports 45GB used. Its like it fails while syncing the library file.
    Things I have tried already. The usual uninstall/reinstall, turning off Windows UAC, turning UAC on and running in admin mode, etc. I have the lastest version of iTunes, and have installed the 5/22 iPod windows update. I also have all other recommended windows updates. I have tried turning of syncing of photos and videos, and have just music selected at this point.
    If anyone has any idea of something I am missing, please help. I guess this weekend I might have to spend time on the phone with tech support if noone has any idea here. Why has it taken 7+ months to get this working in Vista?
    Thank you.

    bump
    No body has any ideas?
    Thanks.

Maybe you are looking for

  • What is a manufacture warranty of the phone?

    Im currently having problems with my z2. The touchscreen is all crazy and non responsive. I tried the repair using sus but it didnt do anything to help. I contacted amazon to see if they could exchange it but since it has passed 30 days since i bough

  • I can't get my printer to print to the edge of the page and can't find the right settings.

    I am trying to create an A5 booklet from A4 spreads in InDesign which I have now done but for some reason when I print it is not printing to the edges of the paper. It's about 6mm short on the short edge and 3mm short along the long edge. I don't thi

  • How to use image from a file in signature appearance.

    Hi, I am creating a Plugin for acrobat 9, using PubSec using DocSign sample as basis. I have created the appearance using text objects and the logos data that came with the DocSign sample. But I want to use image from a file (like, jpg) in the signat

  • Problem in XI 30 with End-to-End Monitoring

    Hi people, I'm acceding to the End-to-End Monitoring in the Runtime Workbench. After I introduce all the data for monitoring messages and click Display. It shows the error: [code]java.lang.NullPointerException      at com.sap.plaf.frog.FrogScrollPane

  • Macbook Pro (late 2008) with 8GB ram sporadic freezing / hanging

    Hi, Last year, I was running Lion on my late 2008 MBP with 4GB ram with no problems.  Whilst 4GB is the maximum officially supported for my machine, forum posts suggested that some people had no issues running it with 8GB. I went for the upgrade and