You need to sign in to do that
Don't have an account?
Sureka
How to get substring of a output text in visualforce?
Hi All,
I am using the below format to retrive the feild label:
However I need to remove the last 3 characters of the label during display.
Any Idea?
Thanks
hi,
you cannot use sustring on page...you will have to do that in your controller and then render the value...
other option is to use javascript functions(substr) to do so..
Thanks,
Shailesh. P. Deshpande
You can use visual force function "LEFT" or 'RIGHT' for this purpose :
Command
Description
Use
LEFT
Returns the specified number of characters from the beginning of a text string.
LEFT(text, num_chars) and replace text with the field or expression you want returned; replace num_chars with the number of characters from the left you want returned.
RIGHT
Returns the specified number of characters from the end of a text string.
RIGHT(text, num_chars) and replace text with the field or expression you want returned; replace num_chars with the number of characters from the right you want returned.
It will be something like this :
<apex:page >
<apex:outputText value="{!LEFT('GoodMorning',4)}"></apex:outputText>
<apex:outputText value="{!RIGHT('GoodMorning',7)}"></apex:outputText>
</apex:page>
Thank you very much for this! This worked for me! :catvery-happy:
Thank you Pradeep for your example..
I wasted a lot of time looking for a solution. I'm so lucky to see your post.
Thanks again!
Thanks for the insights.
<apex:column headerValue="Expiration Date" >
<apex:outputText value="{!left(Lease.ExpirationDate,10)}" />
</apex:column>
It saved my day..!!
Trying to get a visual force page that returns cases (similar to the stock related list). I would like the subject to pull in but be truncated so especially long subjects do not shove the rest of the information off the page.
This seems to work halfway well, however it is forcing a comma at the end of every single subject line that is 75 characters or fewer.
Is there a way to 1) remove the comma at the end of each line and 2) add a "..." to the end of only subject values that exceed that limit? i.e. if the subject is fewer than 75 characters, it just displays the subject as is. If the subject is longer than 75 characters, it displays "characterlimit+...".