mirror of
https://github.com/tbamud/tbamud.git
synced 2026-02-24 04:21:44 +01:00
Added a 'toupper' command to dg_scripts.
DG Script command: %string.toupper% This will capitalize the first letter of a string.
This commit is contained in:
@@ -179,6 +179,11 @@ int text_processed(char *field, char *subfield, struct trig_var_data *vd,
|
||||
if (!str_cmp(field, "strlen")) { /* strlen */
|
||||
snprintf(str, slen, "%d", (int)strlen(vd->value));
|
||||
return TRUE;
|
||||
} else if (!str_cmp(field, "toupper")) { /* toupper */
|
||||
char *upper = vd->value;
|
||||
if (*upper)
|
||||
snprintf(str, slen, "%c%s", UPPER(*upper), upper + 1);
|
||||
return TRUE;
|
||||
} else if (!str_cmp(field, "trim")) { /* trim */
|
||||
/* trim whitespace from ends */
|
||||
snprintf(tmpvar, sizeof(tmpvar)-1 , "%s", vd->value); /* -1 to use later*/
|
||||
|
||||
Reference in New Issue
Block a user