Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trim function to remove blanks + returns
Message
 
À
22/07/1996 09:25:43
Paul Wei
Fib, State of Michigan
Lansing, Michigan, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00004308
Message ID:
00004496
Vues:
30
>>>FUNCTION NoCr(tcString)
>>>tcString = ALLTRIM(tcString)
>>>DO WHILE RIGHT(tcString,1) = CHR(13) AND !EMPTY(tcString)
>>> tcString = SUBSTR(tcString,1,LEN(tcString)-1)
>>>ENDDO
>>>RETURN tcString
>>
>>Thanks. I changed a few things.
>>
>>FUNCTION NoCr(tcString)
>>tcString=ALLTRIM(tcString)
>>DO WHILE INLIST(RIGHT(tcString,1),CHR(13),CHR(10),CHR(160)) AND NOT EMPTY(tcString)
>> tcString=ALLTRIM(SUBSTR(tcString,1,LEN(tcString)-1))
>>ENDDO
>>RETURN tcString
>
>
>Just for fun, how about:
>
>FUNCTION NoCr(tcString)
>RETURN ALLTRIM(LEFT(tcString,LEN(TRIM(CHRTRAN(tcString,CHR(13)+CHR(10)+CHR(160),SPACE(3))))))


Hi.

You must be an ex- APL programmer.

What is the character 160 for. I have an emtpy test I use
for checking web form input (it follows). Should I add this
160 to it?

*************************************************************
function mempty
parameter test
*memo empty test to use instead of empty on internet web text areas


* jt is a temporary variable, not very meaningful name though

jt = alltrim(test)
* remove empty space
for i = 1 to len(jt)
ch = substr(jt,i,1)
if ch = " ";
.or. ch = chr(13) ;
.or. ch = chr(10)
* do nothing
else
return .f.
endif
next
return .t.
Jeff Berezin Emedicine.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform