str_for_entfile upper case / capitals

Posted By: Reconnoiter

str_for_entfile upper case / capitals - 11/16/16 15:01

Hi,

Seeing that str_for_entfile gives the entirely filename string of the entity in upper case / capitals (so Item becomes ITEM), is there a way to fix that so that it shows it normally?

ty
Posted By: Reconnoiter

Re: str_for_entfile upper case / capitals - 02/19/17 17:27

I just noticed a solution to this, I dont know if this is the best solution but it does work:

1) use txt_for_dir to get all the model name on startup (/only once)
2) do str_for_entfile when needed
3) compare returned string from str_for_entfile with the text you used in txt_for_dir (use str_cmpi for comparison in a for loop), when match use uppercase correct string from text pstring (e.g. (myText.pstring)[i] ) and break;.
Posted By: Ch40zzC0d3r

Re: str_for_entfile upper case / capitals - 02/19/17 19:43

If you want everything in lowercase this method is just wasting cpu.
Simply go through each character, check if its between 'A' and 'Z' and if yes add 32 or the delta of 'a' - 'A' (which is 32) to get lowercase.
If you want to keep the exact same case as in the names I doubt theres a good way for this
Posted By: Reconnoiter

Re: str_for_entfile upper case / capitals - 02/19/17 21:28

No you misunderstood, I don't want everything lowercase. One can simply use str_lwr(STRING*) for that. I was just posting this solution (which is fine enough for me now) in case someone else had this problem.
© 2024 lite-C Forums