nevermind, I got copilot to do it.
# cfml-general
a
nevermind, I got copilot to do it.
a
care to share - always interesting to see what code it comes up with 🙂
a
I had to tweak it a bit to get it working but the jist of it was tehre
want to see the copilot response?
copilot response was:
Copy code
/**
 * Left pads a string with a specified character to a specified length.
 *
 * @param original The original string to pad.
 * @param length The length to pad to.
 * @param padChar The character to pad with.
 * @return The padded string.
 */
public string function leftPad(string original, numeric length, string padChar=" ") {
    // Calculate the number of padding characters needed
    numeric padLength = length - len(original);

    // If no padding is needed, return the original string
    if (padLength <= 0) {
        return original;
    }

    // Generate the padding string
    string padding = repeatString(padChar, padLength);

    // Return the padded string
    return padding & original;
}
a
interesting. It sort of knows CFML, but also doesn't 🙂
I was wondering if it'd use
repeatString
or do some kind of loop
d
Is what you posted here the original untweaked version?
a
yes, you'll see the syntax isn't right
👍 1
r
I wonder if copilot delved into cflib
😎 1
d
Is there any way to find out what sources it has access to, or actually used?
For chatGPT, I think you can say something like "include sources". Which it might or night not do, and might or might not make up anyway.