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
Mrityunjay Patel 18Mrityunjay Patel 18 

i want to specific value after = and before ;

Hi Everyone,
This is my String and i want to get the value after equal and before semicolon and this value is dynamic.So how to get these specific value Can anyone them help me !
String X = 'System.Location[getLatitude =25.6154;getLongitude=85.101;]'
Best Answer chosen by Mrityunjay Patel 18
Suraj Tripathi 47Suraj Tripathi 47
Hi Mrityunjay Patel,
Greetings!

Please use this code,
Decimal lat = Decimal.valueOf(X.substringAfter('=').substringBefore(';'));
Decimal long = Decimal.valueOf(X.substringBefore(';').substringAfter('='));
System.debug('Latitude->'+lat);
System.debug('Longitude->'+long);
If you find your Solution then mark this as the best answer. 

Thank you!

Regards,
Suraj Tripathi