function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
srikanth julakantisrikanth julakanti 

Convert String From Lowercase To Uppercase

How To Convert String From Lowercase To Uppercase In VF Page
once check My Code Find Out Mistake And Give Me Solution
Apex Code:public with sharing class ChangeController1 {
    string mystring;
    public PageReference change() {
    getValue();
    return null;
    }    
     //public String upper { get; set; }

    //public String lower { get; set; }

    //public String value { set; }
   
   
    public String setValue(string v){
    mystring=v;
    return null;
    }
   
    public String getValue(){
   
    mystring.touppercase();
    return null;
    }
}
public with sharing class ChangeController1 {
    string mystring;
    public PageReference change() {
    getValue();
    return null;
    }    
     //public String upper { get; set; }

    //public String lower { get; set; }

    //public String value { set; }
   
   
    public String setValue(string v){
    mystring=v;
    return null;
    }
   
    public String getValue(){
   
    mystring.touppercase();
    return null;
    }
}
public with sharing class ChangeController1 {
    string mystring;
    public PageReference change() {
    getValue();
    return null;
    }    
     //public String upper { get; set; }

    //public String lower { get; set; }

    //public String value { set; }
   
   
    public String setValue(string v){
    mystring=v;
    return null;
    }
   
    public String getValue(){
   
    mystring.touppercase();
    return null;
    }
}public with sharing class ChangeController1 {
    string mystring;
    public PageReference change() {
    getValue();
    return null;
    }    
     //public String upper { get; set; }

    //public String lower { get; set; }

    //public String value { set; }
   
   
    public String setValue(string v){
    mystring=v;
    return null;
    }
   
    public String getValue(){
   
    mystring.touppercase();
    return null;
    }
}
Vf Page:
<apex:page controller="ChangeController1">
<apex:form >
Value <apex:inputText value="{!value}"/><br/>
lower<apex:outputText /><br/>
upper<apex:outputText /><br/>


<!--Lower <apex:inputText value="{!lower}"/><br/>
Upper <apex:inputText value="{!upper}"/>-->
<apex:commandButton action="{!change}" value="Change"/>
</apex:form>
</apex:page>
Best Answer chosen by srikanth julakanti

All Answers

Pavan DavePavan Dave
I think you need to store the value "mystring.touppercase()"
String newStr = mystring.touppercase();

newStr may print Upper case value.
AshlekhAshlekh
Hi,

You can use LOWER funciton on VFP.

<!--Lower <apex:inputText value="{!lower}"/><br/>
Upper <apex:inputText value="{!UPPER(upper)}"/>-->
<apex:commandButton action="{!change}" value="Change"/>
</apex:form>
</apex:page>



praveen murugesanpraveen murugesan
Hi Srikanth,

See this,

Page:

<apex:page controller="LowerCase_to_UpperCase_Controller">
<apex:form >
Value <apex:inputText value="{!value}"/><br/>
lower<apex:outputText id="id1" value="{!lower}" /><br/>
upper<apex:outputText id="id2" value="{!upper}" /><br/>

<apex:commandButton action="{!change}" value="Change" reRender="id1,id2"/>
</apex:form>
</apex:page>

Controller:

public with sharing class LowerCase_to_UpperCase_Controller{
   
    public String value { get; set; }
    public String upper { get; set; }
    public String lower { get; set; }  
   

    public PageReference change() {
    upper = value.toUpperCase();
    lower = value.toLowerCase();
    
    return null;
    }    
      
}

Mark this as best answer if its helps.

Thanks.

Praveen Murugesan