Left$

Takes two parameters, Source, Value

Description:

When the Value parameter is positive, that number of bytes from the Source parameter will be returned starting from the left side of the Source.

When the Value parameter is negative, everything except for that number of bytes from the Source parameter starting from the right side of the Source will be returned. (This returns the opposite bytes that a Right$ command call on the same Source, and with the same Value but positive instead of negative, would return.)

Note: Moxie.Build is configured for all pages / data to be in UTF-8. The Len$, Right$, and Left$ functions reference byte counts, not character counts. All non-accented Latin characters, as is normal in English, are one byte per character. However, accented characters and non-Latin characters will be multiple bytes per character. Consideration of these limits should always be used when designing code that uses Len$, Right$, and Left$.

Examples:

[New] source    = "123456789"
[New] result1 = Left$ source, 3
[New] result2 = Right$ source, 3
[New] result3 = Left$ source, -3
[New] result4 = Right$ source, -3

Html result1 'result1 is equal to "123"
Html result2 'result2 is equal to "789"
Html result3 'result3 is equal to "123456"
Html result4 'result4 is equal to "456789"
[New] sentence  = "Chocolate is the best"
[New] sectionA = Left$ sentence, 5
[New] sectionB = Right$ sentence, 4
[New] sectionC = Left$ sentence, -10
[New] sectionD = Right$ sentence, -16

Html sectionA 'sectionA is equal to "Choco"
Html sectionB 'sectionB is equal to "best"
Html sectionC 'sectionC is equal to "Chocolate "
Html sectionD 'sectionD is equal to "late is the best"