StrTrim() Enhancement

Started by JTaylor, November 14, 2020, 01:42:44 PM

Previous topic - Next topic

JTaylor

Adding a new flag which causes StrTrim()  to remove Spaces, TABs, CRs and LFs would be very helpful.  Thank you.

Jim

ChuckC

As a stop-gap means of getting that functionality for the time being, have you looked at the string trimming methods available in .NET in System.String class?

JTaylor

No.  I obviously have ways of accomplishing the task.  Just thought it would be an easy and useful addition to the function and avoid extra code.   I can create a function combining StrTrim() and StrClean() that will do the job since I can't think of time, in this context, when I would want to Trim a string and still want CR or LF anywhere in the string.   Run into this issue a lot dealing with web page data.

I didn't realize until today that the function even had flags until I was going to make the suggestion but wanted to read the documentation and make sure it didn't do more than I thought.

Thanks though.

Jim

stanl

OT: but in checking out the flag I ran across StrTypeInfo() which I had never used and just found a use for it.


[EDIT:
To elaborate. I was writing CLR code to check if strings were valid HEX. In order to determine this using .NET system.string involved an additional syste.uri class which contained an IsHexDigit() method. StrTypeInfo() a lot easier.

JTaylor

Thanks for the info.  Will keep this in mind along with Chuck's suggestion.

Jim