Question : VISUAL FOXPRO - HOW TO NUMBER OF CHARACTERS

I am a complete novice with Visual Foxpro or any programming for that matter.

I am trying to make, what seems to be a simple change to the coding.


I have this code:

ALLTRIM(myvaluehere)


In some cases "myvaluehere" may be more than 6 characters, however I want to limit it to only show the first 6 if it happens to be more than that.


How would I go about doing this?

Answer : VISUAL FOXPRO - HOW TO NUMBER OF CHARACTERS

Actually the   LEFT(MyValueHere,6)  by itself will give you the left 6 characters and does not need the ALLTRIM() added unless there might be leading Spaces in the value.

If  the non-blank value of MyValueHere should be less than 6 characters, you will get the value plus a trailing number of Spaces up to a total character count of 6.

Some things to try
   MyValueHere = '1234567890"
   ?LEFT(MyValueHere,6)

   MyValueHere = '1234          "
    ?"|" + LEFT(MyValueHere,6) + "|"

    MyValueHere = '1234"
    ?LEFT(MyValueHere,6)

Good Luck

Random Solutions  
 
programming4us programming4us