You need to sign in to do that
Don't have an account?

how do you remove istdp p1 at the end of URL
I have created a VF page which has a command link that take me to my desired link but there is istdp p1 at the end of the URL which I dont want. Thank you in advance.
<apex:page controller="TechnologyProduct" lightningStylesheets="true" showHeader="false" sidebar="false" applyBodyTag="false" applyHtmlTag="false">
<style type="text/css">
[id*=button] {
border: 1px solid black !important;
color: black !important;
text-decoration: none !important;
padding: 9px !important;
cursor: pointer !important;
}
[id*=wrapper] {
margin: auto;
width: 50%;
text-align: center !important;
padding: 10px;
height: 100px !important;
}
[id*=repeat] {
margin: 20px !important; }
</style>
<div id="wrapper">
<apex:repeat value="{!TechnologyProduct}" var="res" id="repeat">
<apex:outputPanel rendered="{!res.Detail_Link__c != null}" layout='none'>
<apex:outputlink value="{!res.Detail_Link__c}" styleClass="btn" id="button"> {!res.Detailed_Product_Name__c} </apex:outputlink>
</apex:outputPanel>
</apex:repeat>
</div>
</apex:page>
<apex:page controller="TechnologyProduct" lightningStylesheets="true" showHeader="false" sidebar="false" applyBodyTag="false" applyHtmlTag="false">
<style type="text/css">
[id*=button] {
border: 1px solid black !important;
color: black !important;
text-decoration: none !important;
padding: 9px !important;
cursor: pointer !important;
}
[id*=wrapper] {
margin: auto;
width: 50%;
text-align: center !important;
padding: 10px;
height: 100px !important;
}
[id*=repeat] {
margin: 20px !important; }
</style>
<div id="wrapper">
<apex:repeat value="{!TechnologyProduct}" var="res" id="repeat">
<apex:outputPanel rendered="{!res.Detail_Link__c != null}" layout='none'>
<apex:outputlink value="{!res.Detail_Link__c}" styleClass="btn" id="button"> {!res.Detailed_Product_Name__c} </apex:outputlink>
</apex:outputPanel>
</apex:repeat>
</div>
</apex:page>
In the VF page, you can modify the value of the outputlink as follows:
<apex:outputlink value="{!res.Detail_Link__c.replace('istdp p1','')}" styleClass="btn" id="button"> {!res.Detailed_Product_Name__c} </apex:outputlink>
This should remove the "istdp p1" from the end of the URL and give you the desired link.
Replace this line:
<apex:outputlink value="{!res.Detail_Link__c}" styleClass="btn" id="button"> {!res.Detailed_Product_Name__c} </apex:outputlink>
With this line:
<apex:outputlink value="{!LEFT(res.Detail_Link__c, FIND('istdp p1', res.Detail_Link__c) - 1)}" styleClass="btn" id="button"> {!res.Detailed_Product_Name__c} </apex:outputlink>
This uses the LEFT and FIND functions to extract the portion of the URL before the "istdp p1" string and uses that as the value for the output link. https://www.rebaid.org/
VF Page
<apex:page controller="devForamQue" action="{!devForamQue}">
<p>
Google link :: {!urlLink}
</p>
<apex:outputlink value="{!LEFT(urlLink, FIND('istdp p1', urlLink) - 1)}" styleClass="btn" id="button"> Google </apex:outputlink>
</apex:page>
APEX CLass
public class devForamQue {
public string urlLink{get;set;}
public void devForamQue(){
urlLink = 'https://www.google.com/maps/istdp p1';
system.debug('urlLink :: '+urlLink);
}
}
If you find my answer helpful please mark it as the best answer.