Okay, I will say that I understand that G’MIC is definitely not suitable for string manipulation. However, I found out that you can create a library of command specifically for string manipulation. This thread is to share commands for insertion into the str_manipulation_library. I do think it would be little easier than python at a theoretical level once the library is made.
Here’s a small short library.
rep_str_maniputation_library:
m "create_new_string : ('\"$""1\"') "
m "sarcasm_text :
f \"
is_upper_case=inrange(i,97,122,1,1);
is_lower_case=inrange(i,65,90,1,1);
u(0,1)<.5?(
is_upper_case?i-32:(is_lower_case?i+32:i);
):(i);\""
m "call_out_string : u {t} echo ${}"
After you call out the rep_str_manipulation_library, you can access sarcasm_text outside of the command scope.
C:\Windows\System32>gmic rep_str_maniputation_library create_new_string "This is super!" sarcasm_text. call_out_string. rm.
[gmic]-0./ Start G'MIC interpreter.
[gmic]-1./call_out_string/ this IS SuPeR!
[gmic]-1./ Remove image [0] (0 images left).
[gmic]-0./ End G'MIC interpreter.