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
Shubham Panda 7Shubham Panda 7 

How to find the index of elements present in 2 List

hello everyone..
my requirement is like this-
string s1= 'abcde';
string s2= 'abjfesc';
i want to display it in a map like this:-
map<string,list<integer>> (this is what i want)
{a,{0}}
{b,{1}}
{c,{6}}
can anyone please help me to resolve this problem


 
sravan velamasravan velama

You can use Sub string functionality
Example : String s = 'abcd';
String firstLetter = s.subString(0,1); (firstLetter = a)
String secondLetter = s.subString(1,2); (secondLetter = b)