+ Start a Discussion
SubhamSubham 

Replace a String with another string

Hi,

 

I have a variable which stores value of account number in Incremental form

 

now another varible which is used for displaying data on UI used this varible but account number displayed on UI

should not be in Incremental format

Eg.

say there are  account in custom object having account number as

 

Account - 1

Account - 2

 

so on....

 

but on UI it has to be displayed as

'Account'

is there any way of removing characters appearing after Account

 

Regards,

 

Subham

 

Best Answer chosen by Admin (Salesforce Developers) 
Nilesh ManeNilesh Mane

Hi Shubham,

Dont think of removing ending characters, Just think of getting starting characters.

 

Suppose ur string is s or s1,

s= Account-01;

s1=Account-02;

 

in both the cases u want only 7 alphabates of the string. 

 

required string = s.substring(0,6);

 

Result ===> required string='Account'

 

 

:)

All Answers

Nilesh ManeNilesh Mane

Hi Shubham,

Dont think of removing ending characters, Just think of getting starting characters.

 

Suppose ur string is s or s1,

s= Account-01;

s1=Account-02;

 

in both the cases u want only 7 alphabates of the string. 

 

required string = s.substring(0,6);

 

Result ===> required string='Account'

 

 

:)

This was selected as the best answer
SubhamSubham

Thanks Nilesh