sourcemod
sourcemod copied to clipboard
Fixed "%s" always being left justify
Related to: #2331
This only fixes "%s" to always be left-aligned, not include the fix for padding '0'.
If need, I can add a commit to fix the padding '0'.
Test cases
#include <sourcemod>
public void OnPluginStart()
{
char[] text = "abcde1234567890";
PrintToServer("|%s|", NULL_STRING);
PrintToServer("|%s|", text);
PrintToServer("|%.10s|", text);
PrintToServer("|%0.10s|", text);
PrintToServer("|%-.10s|", text);
PrintToServer("|%-0.10s|", text);
PrintToServer("|%20s|", text);
PrintToServer("|%020s|", text);
PrintToServer("|%-20s|", text);
PrintToServer("|%-020s|", text);
}
Click to expand the output before fix
sm plugins reload test
||
|abcde1234567890|
|abcde12345|
|abcde12345|
|abcde12345|
|abcde12345|
|abcde1234567890 |
|abcde1234567890 |
|abcde1234567890 |
|abcde1234567890 |
[SM] Plugin test.smx reloaded successfully.
Click to expand the output after fix
sm plugins reload test
||
|abcde1234567890|
|abcde12345|
|abcde12345|
|abcde12345|
|abcde12345|
| abcde1234567890|
| abcde1234567890|
|abcde1234567890 |
|abcde1234567890 |
[SM] Plugin test.smx reloaded successfully.